/* =============================================================================
   ESTUDIX — Components CSS
   Cards, botões, tags, progress bars, KPIs, navbar, bottom nav, messages
   Baseado no protótipo aprovado (estudix-mobile.html)
   ============================================================================= */

/* --- Botões --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 14px;
    font-family: var(--font);
    font-size: 15px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.2s ease;
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--gradient);
    color: #fff;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    color: #fff;
}

.btn-outline,
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover,
.btn-secondary:hover {
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--muted);
}

.btn-ghost:hover {
    color: var(--text);
}

.btn-sm {
    padding: 10px 16px;
    font-size: 13px;
    border-radius: 12px;
}

.btn-lg {
    padding: 16px 28px;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
    margin-bottom: var(--space-sm);
}

@media (min-width: 768px) {
    .btn-full {
        width: auto;
        min-width: 220px;
    }
}

/* --- Cards --- */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--r2);
    padding: 18px;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
    position: relative;
    overflow: hidden;
}

.card + .card {
    margin-top: 12px;
}

.card-header {
    padding: 0 0 0;
    margin-bottom: 12px;
}

.card-body {
    padding: 0;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

/* Card glow effect */
.card-glow {
    position: absolute;
    top: -40px;
    right: -40px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    filter: blur(40px);
    opacity: 0.4;
    pointer-events: none;
}

/* --- Tags --- */
.tag {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: var(--blue-dim);
    color: var(--blue);
    border: 1px solid rgba(56, 189, 248, 0.15);
}

.tag-green {
    background: var(--green-dim);
    color: var(--green);
    border-color: rgba(16, 185, 129, 0.15);
}

.tag-blue {
    background: var(--blue-dim);
    color: var(--blue);
    border-color: rgba(56, 189, 248, 0.15);
}

.tag-purple {
    background: rgba(168, 85, 247, 0.12);
    color: #A855F7;
    border-color: rgba(168, 85, 247, 0.15);
}

.tag-muted {
    background: rgba(100, 116, 139, 0.12);
    color: var(--muted);
    border-color: rgba(100, 116, 139, 0.15);
}

.tag-amber {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
    border-color: rgba(245, 158, 11, 0.15);
}

/* --- KPI Grid --- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: var(--space-lg);
}

.kpi-box {
    background: rgba(11, 17, 32, 0.5);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
}

.kpi-value {
    display: block;
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--blue);
    margin-top: 4px;
}

.kpi-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
}

/* --- Progress bars --- */
.progress-card {
    padding: 18px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.progress-name {
    font-weight: 700;
    font-size: 14px;
}

.progress-percent {
    font-weight: 700;
    color: var(--green);
    font-size: 13px;
}

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 6px;
    background: var(--gradient2);
    transition: width 0.6s ease;
}

.progress-detail {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 600;
}

/* --- KPI desktop --- */
@media (min-width: 768px) {
    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Stats grid (perfil) --- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    text-align: center;
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.stat-value {
    display: block;
    font-family: var(--mono);
    font-size: 28px;
    font-weight: 700;
    color: var(--blue);
}

.stat-label {
    display: block;
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* --- Profile --- */
.profile-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg);
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    background: var(--gradient);
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.2);
}

.profile-info h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

/* --- Theme toggle --- */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
    color: var(--muted);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
    color: var(--blue);
    border-color: var(--blue);
}

/* Sol no dark, lua no light */
.icon-moon { display: none; }
[data-theme="light"] .icon-sun { display: none; }
[data-theme="light"] .icon-moon { display: block; }

/* --- Navbar (landing) --- */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 17, 32, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(30, 41, 59, 0.6);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.navbar-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: var(--space-md) 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

@media (min-width: 1024px) {
    .navbar-container {
        padding: var(--space-md) 32px;
    }
}

.navbar-logo {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text);
}

.navbar-logo:hover {
    color: var(--text);
}

.logo-x {
    color: var(--blue);
    font-weight: 800;
}

.navbar-logo-img {
    height: 38px;
    width: auto;
    display: block;
}

[data-theme="light"] .navbar-logo-img {
    filter: brightness(0.2);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

/* Hamburger — hidden by default (desktop) */
.navbar-hamburger {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 38px;
    height: 38px;
    place-items: center;
    cursor: pointer;
    padding: 0;
    color: var(--muted);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.navbar-hamburger:hover {
    color: var(--blue);
    border-color: var(--blue);
}

/* Mobile: hamburger visible, links as dropdown */
@media (max-width: 767px) {
    .navbar-hamburger {
        display: grid;
    }

    .navbar-container {
        position: relative;
    }

    .navbar-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--card);
        border-bottom: 1px solid var(--border);
        padding: 12px 20px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        z-index: 99;
    }

    .navbar-links.open {
        display: flex;
    }
}

.navbar-links a {
    color: var(--text2);
    font-size: 14px;
    font-weight: 600;
}

.navbar-links a:hover {
    color: var(--text);
}

.navbar-user {
    color: var(--text2);
    font-size: 14px;
    font-weight: 600;
}

/* --- Bottom Nav (app) --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: var(--nav-h);
    background: linear-gradient(180deg, rgba(11, 17, 32, 0) 0%, var(--bg2) 20%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(30, 41, 59, 0.6);
    display: flex;
    align-items: center;
    justify-content: space-around;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    text-decoration: none;
    transition: color 0.2s ease, transform 0.15s ease;
}

.bottom-nav-item:active {
    transform: scale(0.92);
}

.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: var(--blue);
}

.bottom-nav-icon {
    font-size: 1.25rem;
}

.bottom-nav-label {
    font-weight: 700;
}

@media (min-width: 768px) {
    .bottom-nav {
        left: 50%;
        transform: translateX(-50%);
        max-width: 480px;
        border-radius: 20px 20px 0 0;
        border-left: 1px solid rgba(30, 41, 59, 0.6);
        border-right: 1px solid rgba(30, 41, 59, 0.6);
    }

    .bottom-nav-item {
        flex-direction: row;
        gap: 6px;
        font-size: 11px;
        padding: 10px 20px;
    }
}

/* --- Messages --- */
.messages-container {
    max-width: 430px;
    margin: 0 auto;
    padding: var(--space-sm) 20px;
}

@media (min-width: 768px) {
    .messages-container {
        max-width: 720px;
    }
}

@media (min-width: 1024px) {
    .messages-container {
        max-width: 960px;
    }
}

@media (min-width: 1280px) {
    .messages-container {
        max-width: 1100px;
    }
}

.message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    animation: fadeInUp 0.3s ease;
}

.message-success {
    background: var(--green-dim);
    color: var(--green);
}

.message-info {
    background: var(--blue-dim);
    color: var(--blue);
}

.message-error {
    background: var(--error-dim);
    color: var(--error);
}

.message-warning {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.message-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0 0 0 var(--space-sm);
    opacity: 0.7;
}

.message-close:hover {
    opacity: 1;
}

/* --- Highlight text --- */
.highlight-text {
    font-family: var(--mono);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--blue);
}

/* --- Week chart (desempenho) --- */
.week-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 80px;
    padding: 0 4px;
}

.week-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    height: 100%;
    justify-content: flex-end;
}

.week-bar {
    width: 100%;
    background: var(--gradient2);
    border-radius: 6px 6px 3px 3px;
    min-height: 8px;
    position: relative;
    transition: height 0.3s ease;
}

.week-bar-empty {
    background: var(--border);
}

.week-bar-value {
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
}

.week-bar-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
}

/* --- Divider --- */
.divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

/* --- Install card (PWA) --- */
.install-card {
    background: linear-gradient(135deg, rgba(37,99,235,0.15), rgba(56,189,248,0.15));
    border: 1px solid rgba(56,189,248,0.3);
    border-radius: var(--r2);
    padding: 18px;
    max-width: 430px;
    margin: var(--space-lg) auto 0;
    padding-bottom: 20px;
}

@media (min-width: 768px) {
    .install-card {
        max-width: 720px;
        display: flex;
        align-items: center;
        gap: 18px;
    }

    .install-card-content {
        flex: 1;
        margin-bottom: 0;
    }

    .install-card-btn {
        width: auto;
        min-width: 200px;
        flex-shrink: 0;
    }
}

@media (min-width: 1024px) {
    .install-card {
        max-width: 960px;
    }
}

.install-card-content {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 14px;
}

.install-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--blue-dim);
    border: 1px solid rgba(56, 189, 248, 0.15);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    color: var(--blue);
}

.install-card-text {
    flex: 1;
}

.install-card-text strong {
    display: block;
    font-size: 15px;
    color: var(--text);
    margin-bottom: 4px;
}

.install-card-text span {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.4;
}

.install-card-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 12px;
    background: var(--gradient);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    border-radius: var(--r);
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.install-card-btn:hover {
    opacity: 0.9;
    color: #fff;
}

/* --- Admin Profile Switcher --- */
.admin-switcher {
    position: relative;
    display: inline-block;
}

.admin-switcher-current {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.2s;
}

.admin-switcher-current:hover {
    background: rgba(255, 255, 255, 0.15);
}

[data-theme="light"] .admin-switcher-current {
    background: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .admin-switcher-current:hover {
    background: rgba(0, 0, 0, 0.1);
}

.admin-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
    color: #fff;
}

.admin-switcher-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
}

.admin-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    border-radius: 6px;
    cursor: pointer;
    text-align: left;
}

.admin-menu-item:hover {
    background: var(--border);
}

.admin-menu-item.active {
    background: var(--blue);
    color: #fff;
}

.admin-menu-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* --- Light theme overrides --- */
[data-theme="light"] .navbar {
    background: rgba(255, 255, 255, 0.9);
    border-bottom-color: var(--border);
}

/* Navbar escura forcada (landing/visitante) */
.navbar-dark {
    background: rgba(11, 17, 32, 0.95) !important;
    border-bottom-color: rgba(30, 41, 59, 0.6) !important;
}
.navbar-dark .navbar-logo-img {
    filter: none !important;
}
.navbar-dark .navbar-links a,
.navbar-dark .theme-toggle,
.navbar-dark .navbar-right .theme-toggle {
    color: rgba(255, 255, 255, 0.85);
    border-color: rgba(255, 255, 255, 0.25);
}
.navbar-dark .navbar-links a:hover {
    color: #fff;
}
.navbar-dark .btn-outline {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    background: transparent;
}
.navbar-dark .btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: #fff;
}
.navbar-dark .navbar-user {
    color: rgba(255, 255, 255, 0.75);
}
.navbar-dark .navbar-hamburger {
    color: rgba(255, 255, 255, 0.7);
    border-color: rgba(255, 255, 255, 0.2);
}
.navbar-dark .navbar-hamburger:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}
.navbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}
.navbar-visitor-toggle {
    margin-left: auto;
    margin-right: 12px;
}
.navbar-visitor-btn {
    flex-shrink: 0;
}
@media (max-width: 767px) {
    .navbar-dark .navbar-links {
        background: #0b1120;
        border-bottom-color: rgba(30, 41, 59, 0.6);
    }
}

[data-theme="light"] .bottom-nav {
    background: linear-gradient(180deg, rgba(241, 245, 249, 0) 0%, var(--bg2) 20%);
    border-top-color: var(--border);
}

[data-theme="light"] .card,
[data-theme="light"] .discipline-card,
[data-theme="light"] .module-card,
[data-theme="light"] .type-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .btn-outline,
[data-theme="light"] .btn-secondary {
    background: var(--card);
}

[data-theme="light"] .navbar-dark .btn-outline {
    background: transparent;
}

[data-theme="light"] .kpi-box {
    background: var(--card);
}

[data-theme="light"] .dash-progress {
    background: var(--card);
}
