/* ═══════════════════════════════════════════════════
   ReazonBi Academy — Shared Component Styles
   Reusable across all 42+ inner pages
   References CSS variables from style.css
   ═══════════════════════════════════════════════════ */

/* ═══════════════ LAYOUT COMPONENTS ═══════════════ */

/* Page Container — centered content for inner pages */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-xl);
    padding-top: 96px; /* below fixed header */
    min-height: 100vh;
}

/* Page Header — title + subtitle + breadcrumb area */
.page-header {
    padding: var(--space-2xl) 0 var(--space-xl);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-2xl);
}

.page-header .page-title {
    font-family: var(--font-display);
    font-size: clamp(1.4rem, 2.5vw, 1.9rem);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.page-header .page-subtitle {
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 300;
    margin-bottom: var(--space-md);
}

/* Breadcrumb — navigation trail */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.breadcrumb a:hover {
    color: var(--gold);
}

.breadcrumb .breadcrumb-separator {
    color: var(--text-muted);
    font-size: 0.7rem;
    opacity: 0.6;
    user-select: none;
}

[dir="rtl"] .breadcrumb .breadcrumb-separator {
    transform: scaleX(-1);
}

.breadcrumb .breadcrumb-current {
    color: var(--gold);
    font-weight: 500;
}

/* Content Grid — flexible card grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-xl);
}

/* Sidebar Layout — main + sidebar */
.sidebar-layout {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-2xl);
    align-items: start;
}

[dir="rtl"] .sidebar-layout {
    grid-template-columns: 300px 1fr;
}

.sidebar-layout .sidebar-main {
    min-width: 0;
}

.sidebar-layout .sidebar-aside {
    position: sticky;
    top: 96px;
}

/* Section Divider — gold-accented separator */
.section-divider {
    height: 1px;
    border: none;
    background: linear-gradient(
        90deg,
        transparent,
        var(--border-active),
        var(--gold),
        var(--border-active),
        transparent
    );
    margin: var(--space-2xl) 0;
    opacity: 0.6;
}


/* ═══════════════ CARD COMPONENTS ═══════════════ */

/* Base Card — glass effect */
.card {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-dark));
    opacity: 0;
    transition: var(--transition-normal);
}

.card:hover {
    background: var(--surface-card-hover);
    border-color: var(--border-active);
    transform: translateY(-3px);
    box-shadow: var(--shadow-gold);
}

.card:hover::before {
    opacity: 1;
}

/* Card Unit — learning unit card */
.card-unit {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.card-unit::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), var(--gold-dark));
    opacity: 0;
    transition: var(--transition-normal);
}

.card-unit:hover {
    background: var(--surface-card-hover);
    border-color: var(--border-active);
    transform: translateY(-3px);
    box-shadow: var(--shadow-gold);
}

.card-unit:hover::before {
    opacity: 1;
}

.card-unit .card-unit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.card-unit .card-unit-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-unit .card-unit-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1.6;
}

.card-unit .card-unit-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-top: auto;
}

/* Card Prompt — prompt card */
.card-prompt {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card-prompt:hover {
    background: var(--surface-card-hover);
    border-color: var(--border-active);
}

.card-prompt .card-prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
    gap: var(--space-sm);
}

.card-prompt .card-prompt-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-prompt .card-prompt-code {
    background: var(--navy-darkest);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-md);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--accent-green);
    line-height: 1.6;
    margin-bottom: var(--space-sm);
    direction: ltr;
    text-align: left;
    overflow-x: auto;
}

.card-prompt .card-prompt-tags {
    display: flex;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

/* Card Term — glossary term */
.card-term {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    transition: var(--transition-normal);
    cursor: pointer;
}

.card-term:hover {
    background: var(--surface-card-hover);
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.card-term .card-term-name {
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gold);
    margin-bottom: var(--space-xs);
}

.card-term .card-term-preview {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Card Error — error card */
.card-error {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg) var(--space-xl);
    transition: var(--transition-normal);
    border-inline-start: 3px solid var(--accent-red);
}

.card-error:hover {
    background: var(--surface-card-hover);
    border-color: var(--border-active);
    border-inline-start-color: var(--accent-red);
}

.card-error .card-error-code {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-red);
    margin-bottom: var(--space-xs);
    direction: ltr;
    text-align: left;
}

.card-error .card-error-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.card-error .card-error-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1.6;
}

/* Card Room — room card */
.card-room {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    text-align: center;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.card-room:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-gold);
    border-color: var(--border-active);
}

.card-room .card-room-icon {
    font-size: 1.6rem;
    color: var(--gold);
    margin-bottom: var(--space-xs);
}

.card-room .card-room-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-room .card-room-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 300;
    line-height: 1.6;
}

.card-room .card-room-capacity {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px 16px;
    background: rgba(197, 165, 90, 0.1);
    border: 1px solid var(--border-subtle);
    border-radius: 50px;
    font-size: 0.82rem;
    color: var(--gold);
}

.card-room .card-room-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.card-room .card-room-status.status-open {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.card-room .card-room-status.status-full {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.card-room .card-room-status.status-scheduled {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Card Achievement — achievement badge card */
.card-achievement {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    text-align: center;
    transition: var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

.card-achievement:hover {
    border-color: var(--border-active);
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
}

.card-achievement .card-achievement-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(197, 165, 90, 0.2), rgba(197, 165, 90, 0.05));
    border: 1.5px solid var(--gold);
    border-radius: 50%;
    font-size: 1.4rem;
    color: var(--gold);
}

.card-achievement .card-achievement-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-achievement .card-achievement-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 300;
}

.card-achievement.locked {
    opacity: 0.5;
    filter: grayscale(0.6);
}

.card-achievement.locked .card-achievement-icon {
    border-color: var(--text-muted);
    color: var(--text-muted);
    background: rgba(107, 116, 136, 0.1);
}


/* ═══════════════ LEVEL BADGES ═══════════════ */

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.level-badge.level-1 {
    background: rgba(34, 197, 94, 0.15);
    color: #22C55E;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.level-badge.level-2 {
    background: rgba(249, 115, 22, 0.15);
    color: #F97316;
    border: 1px solid rgba(249, 115, 22, 0.3);
}

.level-badge.level-3 {
    background: rgba(220, 38, 38, 0.15);
    color: #DC2626;
    border: 1px solid rgba(220, 38, 38, 0.3);
}

.level-badge.level-4 {
    background: rgba(147, 51, 234, 0.15);
    color: #9333EA;
    border: 1px solid rgba(147, 51, 234, 0.3);
}

.level-badge.level-5 {
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-primary);
    border: 1px solid rgba(148, 163, 184, 0.3);
}


/* ═══════════════ WORLD TAGS ═══════════════ */

.world-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.world-tag.world-api {
    background: rgba(59, 130, 246, 0.12);
    color: #60A5FA;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.world-tag.world-sdk {
    background: rgba(34, 197, 94, 0.12);
    color: #4ADE80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.world-tag.world-mcp {
    background: rgba(168, 85, 247, 0.12);
    color: #C084FC;
    border: 1px solid rgba(168, 85, 247, 0.25);
}

.world-tag.world-agents {
    background: rgba(249, 115, 22, 0.12);
    color: #FB923C;
    border: 1px solid rgba(249, 115, 22, 0.25);
}

.world-tag.world-rag {
    background: rgba(236, 72, 153, 0.12);
    color: #F472B6;
    border: 1px solid rgba(236, 72, 153, 0.25);
}

.world-tag.world-evals {
    background: rgba(20, 184, 166, 0.12);
    color: #2DD4BF;
    border: 1px solid rgba(20, 184, 166, 0.25);
}

.world-tag.world-aws {
    background: rgba(251, 191, 36, 0.12);
    color: #FBBF24;
    border: 1px solid rgba(251, 191, 36, 0.25);
}

.world-tag.world-production {
    background: rgba(239, 68, 68, 0.12);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}


/* ═══════════════ FILTER / SEARCH COMPONENTS ═══════════════ */

/* Filter Bar — horizontal bar with filters and search */
.filter-bar {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

/* Filter Chip — toggleable filter button */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    background: var(--navy-mid);
    border: 1px solid var(--border-subtle);
    border-radius: 50px;
    font-family: var(--font-primary);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
    user-select: none;
}

.filter-chip:hover {
    border-color: rgba(197, 165, 90, 0.3);
    color: var(--text-primary);
    background: var(--navy-light);
}

.filter-chip.active {
    background: rgba(197, 165, 90, 0.15);
    border-color: var(--border-active);
    color: var(--gold);
}

/* Search Inline — search input with icon */
.search-inline {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-inline .search-inline-input {
    width: 100%;
    padding: 8px 16px;
    font-family: var(--font-primary);
    font-size: 0.85rem;
    background: var(--navy-dark);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
    transition: var(--transition-fast);
}

[dir="rtl"] .search-inline .search-inline-input {
    padding-right: 36px;
}

[dir="ltr"] .search-inline .search-inline-input {
    padding-left: 36px;
}

.search-inline .search-inline-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(197, 165, 90, 0.1);
}

.search-inline .search-inline-input::placeholder {
    color: var(--text-muted);
}

.search-inline .search-inline-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.85rem;
    pointer-events: none;
}

[dir="rtl"] .search-inline .search-inline-icon {
    right: 12px;
}

[dir="ltr"] .search-inline .search-inline-icon {
    left: 12px;
}


/* ═══════════════ PROGRESS COMPONENTS ═══════════════ */

/* Progress Bar — horizontal with gold fill */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--navy-dark);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.progress-bar .progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    border-radius: 3px;
    transition: width 0.6s ease;
    position: relative;
}

.progress-bar .progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.15),
        transparent
    );
    animation: progressShine 2s ease infinite;
}

@keyframes progressShine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-bar.progress-sm {
    height: 4px;
}

.progress-bar.progress-lg {
    height: 10px;
    border-radius: 5px;
}

.progress-bar.progress-lg .progress-bar-fill {
    border-radius: 5px;
}

/* Progress Ring — circular SVG indicator */
.progress-ring {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.progress-ring svg {
    transform: rotate(-90deg);
}

.progress-ring .progress-ring-bg {
    fill: none;
    stroke: var(--navy-dark);
    stroke-width: 4;
}

.progress-ring .progress-ring-fill {
    fill: none;
    stroke: var(--gold);
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease;
}

.progress-ring .progress-ring-text {
    position: absolute;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gold);
}

/* XP Counter */
.xp-counter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: linear-gradient(135deg, rgba(197, 165, 90, 0.2), rgba(197, 165, 90, 0.05));
    border: 1px solid rgba(197, 165, 90, 0.3);
    border-radius: 50px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gold);
}

.xp-counter .xp-value {
    transition: all 0.3s ease;
}

.xp-counter .xp-label {
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--gold-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.xp-counter.xp-animate .xp-value {
    animation: xpPulse 0.5s ease;
}

@keyframes xpPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); color: var(--gold-light); }
    100% { transform: scale(1); }
}

/* Streak Badge */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: rgba(249, 115, 22, 0.12);
    border: 1px solid rgba(249, 115, 22, 0.25);
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
    color: #FB923C;
}

.streak-badge .streak-icon {
    font-size: 0.85rem;
}

.streak-badge .streak-count {
    font-family: var(--font-mono);
}


/* ═══════════════ INTERACTIVE COMPONENTS ═══════════════ */

/* Tabs */
.tabs {
    display: flex;
    gap: 2px;
    background: var(--navy-dark);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 3px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.tab {
    flex-shrink: 0;
    padding: 8px 18px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-primary);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--navy-mid);
}

.tab.active {
    color: var(--gold);
    background: var(--navy-mid);
    box-shadow: var(--shadow-sm);
}

/* Accordion */
.accordion {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.accordion-item {
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: var(--transition-fast);
}

.accordion-item.open {
    border-color: var(--border-active);
}

.accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    background: transparent;
    border: none;
    width: 100%;
    font-family: var(--font-primary);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
    text-align: inherit;
}

.accordion-header:hover {
    background: var(--surface-card-hover);
}

.accordion-header .accordion-icon {
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: transform var(--transition-normal);
    flex-shrink: 0;
}

.accordion-item.open .accordion-header .accordion-icon {
    transform: rotate(180deg);
}

.accordion-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height var(--transition-normal);
}

.accordion-item.open .accordion-body {
    max-height: 1000px;
}

.accordion-body-inner {
    padding: 0 var(--space-lg) var(--space-lg);
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.modal.open {
    display: flex;
}

.modal .modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(5, 10, 24, 0.85);
    backdrop-filter: blur(8px);
}

.modal .modal-dialog {
    position: relative;
    background: var(--navy-mid);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    z-index: 1;
}

.modal .modal-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.modal .modal-dialog-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal .modal-dialog-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: var(--transition-fast);
}

.modal .modal-dialog-close:hover {
    color: var(--text-primary);
}

.modal .modal-dialog-body {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.modal .modal-dialog-footer {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 12px 20px;
    background: var(--navy-mid);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 0.85rem;
    color: var(--text-primary);
    transform: translateY(120%);
    opacity: 0;
    transition: all var(--transition-normal);
    max-width: 400px;
}

[dir="rtl"] .toast {
    right: 24px;
}

[dir="ltr"] .toast {
    left: 24px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast .toast-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.toast.toast-success {
    border-inline-start: 3px solid var(--accent-green);
}

.toast.toast-success .toast-icon {
    color: var(--accent-green);
}

.toast.toast-error {
    border-inline-start: 3px solid var(--accent-red);
}

.toast.toast-error .toast-icon {
    color: var(--accent-red);
}

.toast.toast-info {
    border-inline-start: 3px solid var(--accent-blue);
}

.toast.toast-info .toast-icon {
    color: var(--accent-blue);
}

.toast .toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 2px;
    margin-inline-start: var(--space-sm);
    transition: var(--transition-fast);
}

.toast .toast-close:hover {
    color: var(--text-primary);
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 6px 12px;
    background: var(--navy-light);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--text-primary);
    white-space: nowrap;
    box-shadow: var(--shadow-md);
    z-index: 100;
    pointer-events: none;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
}

.tooltip .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--navy-light);
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ═══════════════ BUTTON EXTENSIONS ═══════════════ */

/* Icon-only button */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--navy-mid);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    background: var(--navy-light);
    color: var(--gold);
    border-color: var(--border-active);
}

/* WhatsApp share button */
.btn-share-whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #25D366;
    border: none;
    border-radius: 4px;
    color: #fff;
    font-family: var(--font-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-share-whatsapp:hover {
    background: #1DA851;
    transform: translateY(-1px);
}

/* Email share button */
.btn-share-email {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--navy-mid);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-share-email:hover {
    background: var(--navy-light);
    color: var(--gold);
    border-color: var(--border-active);
}

/* Copy to clipboard button */
.btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--navy-mid);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-copy:hover {
    background: var(--navy-light);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.btn-copy.copied {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--accent-green);
}

/* Save / Bookmark button */
.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font-primary);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-save:hover {
    color: var(--gold);
    border-color: var(--border-active);
}

.btn-save.saved {
    background: rgba(197, 165, 90, 0.15);
    border-color: var(--border-active);
    color: var(--gold);
}


/* ═══════════════ FORM COMPONENTS ═══════════════ */

/* Styled Select */
.select-styled {
    position: relative;
    display: inline-block;
}

.select-styled select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    padding: 8px 36px 8px 14px;
    background: var(--navy-dark);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    cursor: pointer;
    outline: none;
    transition: var(--transition-fast);
    min-width: 140px;
}

[dir="rtl"] .select-styled select {
    padding: 8px 14px 8px 36px;
}

.select-styled select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(197, 165, 90, 0.1);
}

.select-styled::after {
    content: '';
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid var(--text-muted);
    pointer-events: none;
}

[dir="rtl"] .select-styled::after {
    left: 14px;
}

[dir="ltr"] .select-styled::after {
    right: 14px;
}

/* Styled Checkbox */
.checkbox-styled {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    user-select: none;
}

.checkbox-styled input[type="checkbox"] {
    display: none;
}

.checkbox-styled .checkbox-box {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-subtle);
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    background: var(--navy-dark);
}

.checkbox-styled input[type="checkbox"]:checked + .checkbox-box {
    background: var(--gold-dark);
    border-color: var(--gold);
}

.checkbox-styled input[type="checkbox"]:checked + .checkbox-box::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: solid var(--navy-darkest);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox-styled:hover .checkbox-box {
    border-color: var(--gold);
}

/* Styled Radio */
.radio-styled {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    user-select: none;
}

.radio-styled input[type="radio"] {
    display: none;
}

.radio-styled .radio-circle {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border-subtle);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
    flex-shrink: 0;
    background: var(--navy-dark);
}

.radio-styled input[type="radio"]:checked + .radio-circle {
    border-color: var(--gold);
}

.radio-styled input[type="radio"]:checked + .radio-circle::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
}

.radio-styled:hover .radio-circle {
    border-color: var(--gold);
}

/* Styled Textarea */
.textarea-styled {
    width: 100%;
    padding: 12px 16px;
    background: var(--navy-dark);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.textarea-styled:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(197, 165, 90, 0.1);
}

.textarea-styled::placeholder {
    color: var(--text-muted);
}


/* ═══════════════ PAGE TRANSITIONS ═══════════════ */

.page-content {
    opacity: 1;
    transition: opacity var(--transition-normal);
}

.page-enter {
    animation: pageEnter 0.35s ease forwards;
}

.page-exit {
    animation: pageExit 0.2s ease forwards;
}

@keyframes pageEnter {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pageExit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-8px);
    }
}


/* ═══════════════ CREDIT LINE ═══════════════ */

.credit-line {
    text-align: center;
    padding: 8px var(--space-md);
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 300;
    letter-spacing: 0.3px;
}


/* ═══════════════ RESPONSIVE ═══════════════ */

/* Tablet — 768px */
@media (max-width: 768px) {
    .page-container {
        padding: 0 var(--space-md);
        padding-top: 88px;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-layout {
        grid-template-columns: 1fr;
    }

    [dir="rtl"] .sidebar-layout {
        grid-template-columns: 1fr;
    }

    .sidebar-layout .sidebar-aside {
        position: static;
        order: -1;
    }

    .filter-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding: var(--space-sm) var(--space-md);
        gap: var(--space-sm);
    }

    .filter-bar::-webkit-scrollbar {
        display: none;
    }

    .modal .modal-dialog {
        max-width: 100%;
        margin: 0 var(--space-sm);
        padding: var(--space-xl);
    }

    .tabs {
        overflow-x: auto;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }
}

/* Mobile — 375px */
@media (max-width: 375px) {
    .page-header .page-title {
        font-size: 1.3rem;
    }

    .content-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .card,
    .card-unit,
    .card-prompt,
    .card-term,
    .card-error,
    .card-room,
    .card-achievement {
        padding: var(--space-md);
    }

    .filter-bar {
        padding: var(--space-sm);
    }

    .filter-chip {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .toast {
        max-width: calc(100vw - 48px);
    }

    [dir="rtl"] .toast {
        right: 16px;
    }

    [dir="ltr"] .toast {
        left: 16px;
    }
}
