/* =========================================
   Design System & Variables (App Theme Match)
   ========================================= */
:root {
    /* Colors - Brand (From Android App) */
    --primary: #8A5A52;
    /* Terracotta */
    --primary-dark: #6B4A44;
    /* Dark Brown Text */
    --primary-light: #A67069;

    /* Colors - Backgrounds */
    --bg-body: #F6E9DC;
    /* Main App Bg (Cream) */
    --bg-card: #FFFCFA;
    /* White Soft */
    --bg-sidebar: #F8EDE3;
    /* Alt Bg */
    --bg-input: #FFFFFF;

    /* Colors - Text */
    --text-primary: #6B4A44;
    /* Main Text (Dark Brown) */
    --text-secondary: #A89F96;
    /* Secondary Text */
    --text-muted: #D9CBBF;
    /* Borders/Muted */

    /* Colors - Status */
    --success: #00897B;
    /* Teal (Rest Icon) */
    --warning: #E65100;
    /* Orange (Study Icon) */
    --danger: #B00020;
    /* Red */

    /* Spacing & Borders */
    --radius-sm: 12px;
    --radius-md: 20px;
    --radius-lg: 24px;

    /* Shadows - Soft & Warm */
    --shadow-sm: 0 2px 4px rgba(138, 90, 82, 0.05);
    --shadow-md: 0 4px 12px rgba(138, 90, 82, 0.08);
    --shadow-lg: 0 8px 24px rgba(138, 90, 82, 0.12);

    /* Transitions */
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================
   Typography
   ========================================= */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

a {
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* =========================================
   Components: Buttons
   ========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    gap: 0.5rem;
    letter-spacing: 0.02em;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(138, 90, 82, 0.2);
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(138, 90, 82, 0.3);
}

.btn-secondary {
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
    border: 1px solid var(--text-muted);
}

.btn-secondary:hover {
    background-color: #EFE4D9;
    border-color: var(--primary-light);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border: 1px solid rgba(176, 0, 32, 0.2);
}

.btn-danger:hover:not(:disabled) {
    background-color: rgba(176, 0, 32, 0.05);
    border-color: var(--danger);
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 50%;
    background: transparent;
    color: var(--text-primary);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
}

.btn-icon:hover {
    background-color: rgba(138, 90, 82, 0.1);
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Google Button */
.btn-google {
    background-color: white;
    color: var(--text-dark-brown);
    border: 1px solid var(--text-muted);
    margin-top: 1rem;
}

.btn-google:hover {
    background-color: var(--bg-card);
    border-color: var(--text-secondary);
}

.google-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
}

/* =========================================
   Components: Forms
   ========================================= */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-sm);
    background-color: var(--bg-input);
    border: 2px solid var(--bg-sidebar);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-light);
    background-color: white;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* =========================================
   Components: Cards & Alerts
   ========================================= */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-error {
    background-color: #FDEDED;
    color: var(--danger);
    border: 1px solid #F5C6CB;
}

.alert-success {
    background-color: #E0F2F1;
    color: var(--success);
    border: 1px solid #B2DFDB;
}

/* =========================================
   Login Layout
   ========================================= */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: var(--bg-body);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
}

.login-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* =========================================
   Dashboard Layout
   ========================================= */
.dashboard-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    /* Sidebar | Content */
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--text-muted);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.sidebar-logo img {
    height: 36px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.nav-item:hover {
    background-color: rgba(138, 90, 82, 0.05);
    color: var(--primary);
}

.nav-item.active {
    background-color: white;
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.user-mini-profile {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(138, 90, 82, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 1.1rem;
    box-shadow: var(--shadow-sm);
}

.user-info-mini {
    flex: 1;
    overflow: hidden;
}

.user-name-mini {
    display: block;
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email-mini {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Dashboard Content */
.main-content {
    padding: 3rem;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 3rem;
}

.welcome-text h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    /* Single column for better flow */
    gap: 2rem;
    max-width: 800px;
    /* Constrain width for readability like an app */
}

/* Specific Cards */
.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
    margin-top: 1.5rem;
}

.info-item label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.info-value {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Plan Badge */
.plan-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

.plan-badge.pro {
    background-color: var(--warning);
    color: white;
    box-shadow: 0 2px 8px rgba(230, 81, 0, 0.25);
}

.plan-badge.free {
    background-color: var(--text-muted);
    color: white;
}

/* Danger Link */
.danger-link {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 4rem;
    padding-bottom: 2rem;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.danger-link:hover {
    opacity: 1;
    color: var(--danger);
    text-decoration: underline;
    cursor: pointer;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(246, 233, 220, 0.9);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(138, 90, 82, 0.2);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Mosal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(62, 39, 35, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background-color: var(--bg-card);
    width: 90%;
    max-width: 480px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    transform: translateY(20px);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background-color: var(--bg-sidebar);
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 50;
        border-right: none;
    }

    .sidebar.active {
        display: flex;
    }

    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 1rem 1.5rem;
        background-color: var(--bg-card);
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        color: var(--primary);
    }

    .main-content {
        padding: 1.5rem;
    }

    .grid-layout {
        gap: 1.5rem;
    }

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