/* SCARAL MASTER ENGINE INTEGRATION */
@import url('system/scaral-master.css');

/* 
 * SCARAL Dashboard Design System
 * Premium Glassmorphism & Modern UI 
 */

:root {
    --accent-purple: var(--sc-color-accent);
    --accent-teal: var(--sc-color-primary);
    --accent-blue: var(--sc-color-secondary);
    --glass-bg: var(--sc-surface-glass);
    --glass-border: var(--sc-glass-border);
    --card-shadow: var(--sc-shadow-soft);
}

body {
    background-color: #020617;
    color: #f8fafc;
    font-family: 'Outfit', 'Sarabun', sans-serif;
    margin: 0;
    min-height: 100vh;
}

/* Layout */
.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--glass-border);
    padding: var(--sc-space-xl) 20px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.main-content {
    flex: 1;
    padding: 40px;
    background: radial-gradient(circle at top right, rgba(188, 0, 255, 0.05), transparent 40%),
        radial-gradient(circle at bottom left, rgba(0, 242, 255, 0.05), transparent 40%);
}

/* Sidebar Elements */
.logo {
    font-size: var(--fs-logo);
    /* Standardized */
    font-weight: 900;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: var(--sc-space-sm);
}

.nav-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    padding: 12px 18px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
}

.nav-item:hover {
    background: var(--glass-bg);
    color: white;
}

.nav-item.active {
    background: var(--sc-surface-active);
    color: white;
    border: 1px solid var(--sc-color-primary);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.hero-welcome h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0 0 5px 0;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-desc {
    color: #94a3b8;
    margin: 0;
    font-size: 0.95rem;
}

.header-user-actions {
    display: flex;
    align-items: center;
    gap: var(--sc-space-md);
}

.user-status-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px 16px;
    border-radius: var(--sc-space-md);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    transition: all 0.3s ease;
}

.user-status-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.user-avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #3b82f6, hsl(var(--sc-accent)));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.user-info {
    text-align: left;
}

#logged-user-name {
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

#logged-user-role-label {
    font-size: 0.7rem;
    color: hsl(var(--sc-accent));
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    padding: var(--sc-space-sm) 18px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.3s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    transform: translateY(-2px);
}

/* Cards & Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--sc-space-lg);
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--sc-space-lg);
    padding: 25px;
    box-shadow: var(--card-shadow);
}

.card-title {
    color: #94a3b8;
    font-size: 0.9rem;
    margin-bottom: var(--sc-space-sm);
}

.card-value {
    font-size: var(--fs-stat);
    /* Standardized */
    font-weight: 800;
    color: white;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-card {
    background: #0f172a;
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    width: 100%;
    max-width: 650px;
    padding: 40px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Forms */
.form-group {
    margin-bottom: var(--sc-space-lg);
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-family: inherit;
    outline: none;
    transition: all 0.3s ease;
}

select option {
    background: #0f172a;
    color: white;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent-teal);
    background: var(--sc-glass-border);
}

/* Buttons */
.btn-primary {
    background: var(--accent-purple);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    filter: brightness(1.2);
    transform: translateY(-2px);
}

.btn-action-primary {
    width: 100%;
    background: var(--sc-gradient-primary);
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: var(--sc-radius-md);
    font-weight: 800;
    font-family: var(--sc-font-main);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: var(--sc-shadow-glow);
    border: 1px solid var(--sc-glass-border);
}

.btn-action-primary i {
    font-size: 1.2rem;
}

.btn-action-primary:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 30px -5px rgba(0, 242, 255, 0.4);
    filter: brightness(1.1);
}

.btn-action-primary:active {
    transform: translateY(0) scale(0.98);
}

/* Table */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    padding: var(--sc-space-md);
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.02);
}

td {
    padding: var(--sc-space-md);
    border-bottom: 1px solid var(--glass-border);
}

/* Utilities */
.trend-up {
    color: hsl(var(--sc-accent));
    font-size: 0.85rem;
    margin-top: 5px;
}

/* Specialized Components */
.wealth-roadmap-card {
    margin-top: var(--sc-space-xl);
    border: 1px solid var(--sc-color-accent) !important;
    background: var(--sc-gradient-dark) !important;
    backdrop-filter: blur(10px);
}

.ai-stat-card {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--sc-space-md);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.premium-input-container {
    background: rgba(255, 255, 255, 0.03);
    padding: var(--sc-space-md);
    border-radius: var(--sc-space-md);
    border: 1px solid var(--glass-border);
    display: flex;
    gap: var(--sc-space-md);
}

.property-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sc-space-lg);
}

.chart-container {
    height: 300px;
    position: relative;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sc-space-xl);
}

.badge {
    padding: 4px 10px;
    border-radius: var(--sc-space-sm);
    font-size: var(--sc-space-sm);
    font-weight: bold;
    letter-spacing: 1px;
}

.badge-purple {
    background: rgba(188, 0, 255, 0.1);
    color: var(--accent-purple);
}

.badge-teal {
    background: rgba(0, 242, 255, 0.1);
    color: var(--accent-teal);
}

/* --- Advanced Mobile UI System (SCARAL Elite) --- */
.mobile-top-bar {
    display: none;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 5000;
    opacity: 0;
    visibility: hidden;
    transition: 0.3s;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.sidebar-close-btn {
    display: none;
}

@media (max-width: 1024px) {

    /* Top Bar for Mobile */
    .mobile-top-bar {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        padding: 10px 20px;
        background: rgba(15, 23, 42, 0.9);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--glass-border);
        position: sticky;
        top: 0;
        z-index: 1000;
    }

    /* Target the actions wrapper specifically */
    .nav-actions-wrapper {
        display: flex;
        align-items: center;
        flex-direction: row-reverse;
        /* Put Identity on the left of Hamburger */
        gap: 0;
    }

    .logo-mobile {
        font-weight: 900;
        letter-spacing: 2px;
        color: hsl(var(--sc-accent));
        font-size: 1.2rem;
    }

    .hamburger-btn {
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
        cursor: pointer;
        transition: 0.3s;
    }

    .hamburger-btn:hover {
        background: rgba(255, 255, 255, 0.05);
        border-color: var(--accent-teal);
    }

    .container {
        flex-direction: column;
    }

    /* Modern Side Drawer */
    .sidebar {
        position: fixed;
        top: 0;
        left: -320px;
        width: 300px;
        height: 100vh;
        z-index: 10000;
        transition: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: var(--sc-space-lg) 0 50px rgba(0, 0, 0, 0.5);
        padding-top: 60px;
    }

    .sidebar.mobile-active {
        left: 0;
    }

    .sidebar-close-btn {
        display: block;
        position: absolute;
        top: var(--sc-space-lg);
        right: var(--sc-space-lg);
        color: #ef4444;
        font-size: 1.5rem;
        cursor: pointer;
    }

    .nav-links {
        overflow-y: auto;
        max-height: 80vh;
    }

    .nav-item i {
        display: block;
    }

    .nav-item {
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .main-content {
        padding: 25px 20px;
    }

    /* Header Compact Stack - Professional Hero Style */
    .header {
        flex-direction: column;
        gap: 25px;
        text-align: center;
        align-items: stretch;
        /* Stretch to fill width */
        margin-bottom: 35px;
    }

    .hero-welcome {
        padding: var(--sc-space-xl) 20px;
        background: radial-gradient(circle at top right, rgba(188, 0, 255, 0.1), transparent),
            linear-gradient(135deg, rgba(30, 41, 59, 0.4), rgba(15, 23, 42, 0.7));
        border-radius: 28px;
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    }

    .hero-welcome h1 {
        font-size: 1.4rem;
        line-height: 1.3;
        margin-bottom: 12px;
        background: linear-gradient(to bottom, #fff, #cbd5e1);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .hero-desc {
        font-size: 0.85rem;
        line-height: 1.7;
        color: #94a3b8;
        padding: 0 10px;
    }

    .header .header-user-actions {
        display: none !important;
    }

    .user-status-card {
        width: auto;
        padding: 0;
        background: transparent !important;
        border: none !important;
    }

    .btn-logout {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    /* Grid Optimization: 2 Columns for better space usage */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .card {
        padding: 18px;
        border-radius: var(--sc-space-md);
    }

    .card-title {
        font-size: 0.75rem;
        margin-bottom: 5px;
    }

    .card-value {
        font-size: 1.4rem;
    }

    /* Fix Charts Grid for Mobile */
    .charts-grid {
        grid-template-columns: 1fr !important;
        gap: var(--sc-space-lg) !important;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
        /* Back to 1 col for very small screens */
    }

    .header-user-actions button {
        width: 100%;
    }
}