/* ==========================================================================
   DECORAL STUDIO BMS - SYSTEM DESIGN SYSTEM & STYLING
   ========================================================================== */

/* --- CSS Variables & Theme Definition --- */
:root {
    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Light Theme Palette (Inspired by Orlando Dashboard) */
    --bg-primary: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --border-color: #f1f5f9;
    --border-hover: #e2e8f0;
    
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    
    /* Accents */
    --accent-indigo: #6366f1;
    --accent-indigo-glow: rgba(99, 102, 241, 0.08);
    --accent-purple: #8b5cf6;
    --accent-purple-glow: rgba(139, 92, 246, 0.08);
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    
    /* System Feedback States */
    --state-success: #0d9488;
    --state-success-bg: #ccfbf1;
    --state-warning: #ea580c;
    --state-warning-bg: #ffedd5;
    --state-danger: #e11d48;
    --state-danger-bg: #ffe4e6;

    /* Shadows & Radii */
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.03), 0 2px 8px -1px rgba(0, 0, 0, 0.01);
    --shadow-popover: 0 12px 30px -4px rgba(0, 0, 0, 0.08);
    --shadow-focus: 0 0 0 4px rgba(99, 102, 241, 0.15);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-round: 9999px;

    --transition-speed: 0.3s;
    --transition-ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Palette (Obsidian Luxury) */
body.dark-theme {
    --bg-primary: #080c14;
    --bg-sidebar: #0f1420;
    --bg-card: #141b2b;
    --border-color: rgba(255, 255, 255, 0.04);
    --border-hover: rgba(255, 255, 255, 0.08);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-indigo: #818cf8;
    --accent-indigo-glow: rgba(129, 140, 248, 0.1);
    --accent-purple: #a78bfa;
    --accent-purple-glow: rgba(167, 139, 250, 0.1);
    --accent-gradient: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    
    --state-success: #2dd4bf;
    --state-success-bg: rgba(45, 212, 191, 0.1);
    --state-warning: #fb923c;
    --state-warning-bg: rgba(251, 146, 60, 0.1);
    --state-danger: #fb7185;
    --state-danger-bg: rgba(251, 113, 133, 0.1);

    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.3), 0 2px 8px -1px rgba(0, 0, 0, 0.2);
    --shadow-popover: 0 12px 30px -4px rgba(0, 0, 0, 0.5);
    --shadow-focus: 0 0 0 4px rgba(129, 140, 248, 0.25);
}

/* --- Base Resets & Layout --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background-color var(--transition-speed) var(--transition-ease), 
                color var(--transition-speed) var(--transition-ease);
}

input, button, select, textarea {
    font-family: inherit;
    color: inherit;
}

/* Custom Scrollbar for Premium Feel */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-hover);
    border-radius: var(--radius-round);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Core Loading Screen --- */
.initial-loader {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
    width: 100vw;
    background-color: var(--bg-primary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--accent-indigo);
    border-radius: var(--radius-round);
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.initial-loader p {
    font-family: var(--font-heading);
    font-weight: 500;
    color: var(--text-secondary);
}

/* ==========================================================================
   AUTHENTICATION VIEW (LOGIN SCREEN)
   ========================================================================== */
.login-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background: radial-gradient(circle at 10% 20%, var(--accent-indigo-glow) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, var(--accent-purple-glow) 0%, transparent 40%);
}

.login-card {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    width: 100%;
    max-width: 440px;
    padding: 40px;
    border-radius: var(--radius-lg);
    animation: slideIn 0.5s var(--transition-ease);
}

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

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 32px;
}

.login-logo i {
    font-size: 32px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.login-logo p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 16px;
    transition: color var(--transition-speed);
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition-speed), box-shadow var(--transition-speed);
}

.form-input:focus {
    border-color: var(--accent-indigo);
    box-shadow: var(--shadow-focus);
}

.form-input:focus + i {
    color: var(--accent-indigo);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    transition: opacity var(--transition-speed), transform 0.1s var(--transition-ease);
}

.btn-primary:hover {
    opacity: 0.95;
}

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

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

.login-error {
    background-color: var(--state-danger-bg);
    color: var(--state-danger);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    display: none;
    align-items: center;
    gap: 8px;
    animation: shake 0.4s var(--transition-ease);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ==========================================================================
   MAIN DASHBOARD SHELL LAYOUT
   ========================================================================== */
.dashboard-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-logo {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo i {
    font-size: 24px;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-logo h2 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-logo span {
    font-family: var(--font-body);
    font-size: 11px;
    font-weight: 500;
    color: var(--accent-purple);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-item:hover {
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--accent-indigo-glow);
    color: var(--accent-indigo);
    font-weight: 600;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    width: 4px;
    background-color: var(--accent-indigo);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 170px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-round);
    background: var(--accent-gradient);
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
}

.user-details {
    overflow: hidden;
}

.user-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-speed), background-color var(--transition-speed);
}

.btn-logout:hover {
    color: var(--state-danger);
    background-color: var(--state-danger-bg);
}

/* --- Content Panel --- */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

/* Header */
.dashboard-header {
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-color);
    padding: 20px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 9;
}

.header-greeting h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-greeting p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Theme Toggle Button styling */
.theme-toggle-btn {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    font-size: 16px;
    transition: border-color var(--transition-speed), color var(--transition-speed);
}

.theme-toggle-btn:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.theme-toggle-btn .fa-sun {
    display: none;
}

body.dark-theme .theme-toggle-btn .fa-moon {
    display: none;
}

body.dark-theme .theme-toggle-btn .fa-sun {
    display: block;
}

/* View Container */
.view-container {
    padding: 40px;
    flex: 1;
    animation: fadeIn 0.4s var(--transition-ease);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ==========================================================================
   MODULE: DASHBOARD OVERVIEW VIEW
   ========================================================================== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.metric-card {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: border-color var(--transition-speed), transform var(--transition-speed);
}

.metric-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.metric-details p {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.metric-details h3 {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
}

.metric-icon.blue {
    background-color: rgba(99, 102, 241, 0.08);
    color: var(--accent-indigo);
}
.metric-icon.purple {
    background-color: rgba(139, 92, 246, 0.08);
    color: var(--accent-purple);
}
.metric-icon.orange {
    background-color: rgba(234, 88, 12, 0.08);
    color: var(--state-warning);
}
.metric-icon.teal {
    background-color: rgba(13, 148, 136, 0.08);
    color: var(--state-success);
}

.welcome-banner {
    background: var(--accent-gradient);
    color: #ffffff;
    padding: 32px 40px;
    border-radius: var(--radius-lg);
    margin-bottom: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 30px rgba(99, 102, 241, 0.15);
}

.welcome-text h2 {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.welcome-text p {
    font-size: 14px;
    opacity: 0.9;
    max-width: 500px;
    line-height: 1.5;
}

.welcome-banner i {
    font-size: 64px;
    opacity: 0.25;
}

/* Dynamic Cards for Dashboard Features */
.features-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.panel-card {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    padding: 28px;
    border-radius: var(--radius-lg);
}

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

.panel-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 700;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 13px;
}
