/* ==========================================================================
   Clinical Pearls Styles
   ========================================================================== */

/* List View Grid */
.pearls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding-bottom: 30px;
}

.pearl-topic-card {
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.06);
    --card-shadow: var(--shadow-sm);

    --orb-1: rgba(88, 101, 242, 0.2);
    --orb-2: rgba(139, 92, 246, 0.12);
    --orb-3: rgba(59, 130, 246, 0.15);

    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

body.dark-mode .pearl-topic-card {
    --card-bg: #030303;
    --card-border: rgba(255, 255, 255, 0.05);
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);

    --orb-1: rgba(88, 101, 242, 0.35);
    --orb-2: rgba(139, 92, 246, 0.2);
    --orb-3: rgba(59, 130, 246, 0.25);
}

.pearl-topic-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background:
        radial-gradient(circle at -10% -10%, var(--orb-1) 0%, transparent 65%),
        radial-gradient(circle at 110% 50%, var(--orb-2) 0%, transparent 65%),
        radial-gradient(circle at 40% 120%, var(--orb-3) 0%, transparent 65%);
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.4s ease, transform 0.6s ease;
}

.pearl-topic-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(108, 92, 231, 0.3);
}

.pearl-topic-card:hover::after {
    transform: scale(1.1);
}

.pearl-topic-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

/* Dark mode specific tweaks for topics */
body.dark-mode .pearl-topic-card {
    background: var(--card-bg);
    /* using variable above */
}

.dark-mode .pearl-topic-card:hover {
    border-color: var(--primary);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.15);
}

.pearl-topic-info h4 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.pearl-topic-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

/* Detail View Slider */
#pearlsDetailView {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 160px);
    /* Adjust based on header/padding */
    min-height: 400px;
    animation: fadeIn 0.3s ease;
}

.pearls-detail-header {
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.pearls-slider-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    /* Hide cards outside the view */
    border-radius: var(--radius-xl);
    margin-bottom: 20px;
    /* Make sure it has a height */
    min-height: 300px;
}

.pearls-slider-track {
    display: flex;
    height: 100%;
    width: 100%;
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    /* The track will be translated horizontally to show different cards */
}

/* Individual Slide Card */
.pearl-slide-card {
    flex: 0 0 100%;
    min-width: 100%;
    width: 100%;
    /* Each card takes full width of container */
    height: 100%;
    padding: 0 10px;
    /* Slight padding so cards don't touch edges perfectly */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.pearl-card-inner {
    background: var(--surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 30px;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    overflow-y: auto;
    /* Allow scrolling within the card if content is long */
}

/* Dark mode tweaks for inner card */
.dark-mode .pearl-card-inner {
    background: var(--surface-light);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.05);
}

.pearl-step-badge {
    display: inline-block;
    background: var(--primary-ultra-light);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    border-radius: 50px;
    margin-bottom: 15px;
    align-self: flex-start;
}

.pearl-card-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text);
    line-height: 1.3;
}

.pearl-card-content {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    flex: 1;
    /* Push anything below it down */
}

/* Formatting inside the content area */
.pearl-card-content ul,
.pearl-card-content ol {
    margin-bottom: 16px;
    padding-left: 20px;
}

.pearl-card-content li {
    margin-bottom: 8px;
}

.pearl-card-content strong {
    color: var(--text);
}

.pearl-card-content h5 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 16px 0 8px 0;
    color: var(--text);
}

.pearl-alert {
    background: rgba(255, 152, 0, 0.1);
    border-left: 4px solid #FF9800;
    padding: 12px 16px;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    margin-top: 20px;
    font-size: 0.9rem;
}

.pearl-alert.danger {
    background: rgba(244, 67, 54, 0.1);
    border-left-color: #F44336;
}

/* Slider Controls */
.pearls-slider-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 10px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-top: 10px;
}

/* Custom Navigation Buttons */
.pearl-nav-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.25);
}

.pearl-nav-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(108, 92, 231, 0.3);
}

.pearl-nav-btn:active {
    transform: translateY(0);
}

.pearl-nav-btn.secondary {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border-light);
    box-shadow: none;
}

.pearl-nav-btn.secondary:hover {
    background: var(--border-light);
    color: var(--text);
}

.dark-mode .pearl-nav-btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .pearl-nav-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Close Button in Header */
.pearl-close-btn {
    background: rgba(244, 67, 54, 0.1);
    color: #F44336;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.pearl-close-btn:hover {
    background: rgba(244, 67, 54, 0.2);
    transform: translateY(-1px);
}

.pearls-indicators {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex: 1;
}

.pearl-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.pearl-dot.active {
    background: var(--primary);
    transform: scale(1.3);
}

.dark-mode .pearl-dot {
    background: rgba(255, 255, 255, 0.2);
}

.dark-mode .pearl-dot.active {
    background: var(--primary);
}

@media (max-width: 600px) {
    .pearl-card-inner {
        padding: 20px;
    }

    .pearl-card-title {
        font-size: 1.3rem;
    }

    #pearlsDetailView {
        height: calc(100vh - 120px);
    }
}