/**
 * Profi Phone POS v3.0 - Premium Design System Stylesheet
 * 
 * Palette: Deep Navy & Cobalt with Vibrant Accents
 * Typography: Outfit (Headers/Accents) & Inter (Body)
 */

/* -------------------------------------------------------------
 * 1. Design Tokens (CSS Variables)
 * ------------------------------------------------------------- */
:root {
    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Theme: Dark Mode (Default Premium Theme) */
    --bg-app: #0f172a;          /* Slate 900 */
    --bg-card: #1e293b;         /* Slate 800 */
    --bg-input: #0f172a;        /* Slate 900 */
    --bg-hover: #334155;        /* Slate 700 */
    --border-color: #334155;    /* Slate 700 */
    --border-hover: #475569;    /* Slate 600 */
    
    --text-primary: #f8fafc;    /* Slate 50 */
    --text-secondary: #94a3b8;  /* Slate 400 */
    --text-muted: #64748b;      /* Slate 500 */
    
    /* Branding Colors */
    --primary: #3b82f6;         /* Bright Blue */
    --primary-glow: rgba(59, 130, 246, 0.15);
    --primary-hover: #2563eb;
    --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    
    /* Status Colors */
    --success: #10b981;         /* Emerald 500 */
    --success-glow: rgba(16, 185, 129, 0.15);
    --danger: #ef4444;          /* Red 500 */
    --danger-glow: rgba(239, 68, 68, 0.15);
    --warning: #f59e0b;         /* Amber 500 */
    --warning-glow: rgba(245, 158, 11, 0.15);
    --info: #06b6d4;            /* Cyan 500 */
    
    /* Layout Sizes */
    --sidebar-width: 280px;
    --header-height: 70px;
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 15px rgba(59, 130, 246, 0.25);
    
    /* Transition Speed */
    --transition-smooth: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme: Light Mode Override */
html[data-theme="light"] {
    --bg-app: #f1f5f9;          /* Slate 100 */
    --bg-card: #ffffff;         /* Pure White */
    --bg-input: #f8fafc;        /* Slate 50 */
    --bg-hover: #e2e8f0;        /* Slate 200 */
    --border-color: #cbd5e1;    /* Slate 300 */
    --border-hover: #94a3b8;    /* Slate 400 */
    
    --text-primary: #0f172a;    /* Slate 900 */
    --text-secondary: #475569;  /* Slate 600 */
    --text-muted: #94a3b8;      /* Slate 400 */
    
    --primary: #2563eb;
    --primary-glow: rgba(37, 99, 235, 0.1);
    --primary-hover: #1d4ed8;
    --primary-gradient: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.05), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
}

/* -------------------------------------------------------------
 * 2. Reset and General Styles
 * ------------------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.5;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: var(--transition-smooth);
}
a:hover {
    color: var(--primary-hover);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

code {
    font-family: monospace;
    background-color: var(--bg-hover);
    padding: 2px 6px;
    border-radius: var(--border-radius-sm);
    color: var(--primary);
    font-size: 0.9em;
}

/* -------------------------------------------------------------
 * 3. Layout Styles (Grid & Flex Shell)
 * ------------------------------------------------------------- */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100vw;
    position: relative;
}

/* Sidebar Styling */
.app-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    transition: var(--transition-smooth);
}

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

.brand-icon {
    font-size: 1.5rem;
    color: var(--primary);
    filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.4));
    animation: pulse-glow 2s infinite alternate;
}

.brand-text {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex-grow: 1;
    padding: 20px 14px;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 1rem;
}

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

.nav-link.active {
    color: var(--text-primary);
    background-color: var(--primary-glow);
    border-left: 4px solid var(--primary);
    border-radius: 4px var(--border-radius-md) var(--border-radius-md) 4px;
}

.nav-icon {
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

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

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-family: var(--font-heading);
    box-shadow: var(--shadow-sm);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Content Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition-smooth);
}

/* Topbar Header */
.app-topbar {
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    display: none; /* Hidden on desktop */
}

.page-title {
    font-size: 1.4rem;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-clock {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: monospace;
    font-size: 0.95rem;
    background-color: var(--bg-app);
    padding: 6px 14px;
    border-radius: var(--border-radius-sm);
    border: 1px solid var(--border-color);
}

.btn-icon-toggle {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.btn-icon-toggle:hover {
    color: var(--text-primary);
    background-color: var(--bg-hover);
    border-color: var(--border-hover);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-heading);
    font-weight: 500;
    cursor: pointer;
    background: none;
}
.btn-logout:hover {
    color: var(--danger);
    background-color: var(--danger-glow);
    border-color: var(--danger);
}

/* App Content Area */
.app-content {
    padding: 30px;
    flex-grow: 1;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* Footer styling */
.app-footer {
    height: 60px;
    border-top: 1px solid var(--border-color);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    background-color: var(--bg-card);
}

/* -------------------------------------------------------------
 * 4. Cards and Container Styling
 * ------------------------------------------------------------- */
.card-premium {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
}

.card-premium:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-lg);
}

.card-premium-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

/* -------------------------------------------------------------
 * 5. Forms, Inputs and Buttons
 * ------------------------------------------------------------- */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-family: var(--font-heading);
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

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

.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.form-control {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 12px 16px 12px 42px;
    border-radius: var(--border-radius-md);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

/* Buttons */
.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    padding: 12px 24px;
    border-radius: var(--border-radius-md);
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

/* -------------------------------------------------------------
 * 6. Alerts and Toast Notifications
 * ------------------------------------------------------------- */
.alert {
    padding: 16px 20px;
    border-radius: var(--border-radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;
    animation: fade-in 0.3s ease-out;
}

.alert-msg {
    flex-grow: 1;
    font-weight: 500;
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

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

.alert-danger {
    background-color: var(--danger-glow);
    border: 1px solid var(--danger);
    color: var(--danger);
}

.alert-warning {
    background-color: var(--warning-glow);
    border: 1px solid var(--warning);
    color: var(--warning);
}

/* Toast System Container */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 999;
}

/* -------------------------------------------------------------
 * 7. Login Page Specific Styling
 * ------------------------------------------------------------- */
.login-body {
    background: radial-gradient(circle at 10% 20%, #1e293b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
}

.login-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 20px;
}

.login-card {
    background: rgba(30, 41, 59, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    animation: scale-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-brand {
    text-align: center;
    margin-bottom: 35px;
}

.login-brand-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: var(--primary-glow);
    border: 1px solid var(--primary);
    border-radius: 50%;
    color: var(--primary);
    font-size: 2rem;
    margin-bottom: 16px;
    box-shadow: var(--shadow-glow);
}

.login-brand h1 {
    font-size: 1.8rem;
    margin-bottom: 6px;
}

.login-brand p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-login-submit {
    width: 100%;
    background: var(--primary-gradient);
    border: none;
    padding: 14px;
    border-radius: var(--border-radius-md);
    color: #ffffff;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.05rem;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-smooth);
}
.btn-login-submit:hover {
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.login-footer {
    text-align: center;
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.login-address {
    margin-top: 4px;
    opacity: 0.8;
}

/* -------------------------------------------------------------
 * 8. Welcome Page Specific Styling
 * ------------------------------------------------------------- */
.welcome-container {
    max-width: 1000px;
    margin: 40px auto;
}

.welcome-badge {
    display: inline-block;
    background-color: var(--primary-glow);
    color: var(--primary);
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--primary);
    margin-bottom: 16px;
    letter-spacing: 0.05em;
}

.welcome-title {
    font-size: 2.2rem;
    margin-bottom: 12px;
}

.welcome-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.welcome-status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 45px;
}

.status-item {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-icon {
    font-size: 1.6rem;
    color: var(--primary);
}

.status-info {
    display: flex;
    flex-direction: column;
}

.status-label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.status-value {
    font-size: 1rem;
    color: var(--text-primary);
}

.text-success {
    color: var(--success) !important;
}

.welcome-modules-section {
    border-top: 1px solid var(--border-color);
    padding-top: 35px;
}

.welcome-modules-section h3 {
    font-size: 1.4rem;
    margin-bottom: 8px;
}

.welcome-modules-section p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.module-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.module-status-card {
    background-color: var(--bg-app);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

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

.module-status-icon {
    font-size: 1.5rem;
}

.badge-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.module-status-card.enabled {
    border-top: 4px solid var(--success);
}
.module-status-card.enabled .badge-status {
    background-color: var(--success-glow);
    color: var(--success);
}

.module-status-card.disabled {
    opacity: 0.65;
    border-top: 4px solid var(--text-muted);
}
.module-status-card.disabled .badge-status {
    background-color: var(--bg-hover);
    color: var(--text-muted);
}

.module-status-title {
    font-size: 1.05rem;
    margin-bottom: 6px;
}

.module-status-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    flex-grow: 1;
    margin-bottom: 14px;
}

.module-status-version {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
}

/* -------------------------------------------------------------
 * 9. Keyframe Animations
 * ------------------------------------------------------------- */
@keyframes pulse-glow {
    0% { filter: drop-shadow(0 0 2px rgba(59, 130, 246, 0.2)); }
    100% { filter: drop-shadow(0 0 10px rgba(59, 130, 246, 0.6)); }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scale-up {
    from { opacity: 0; transform: scale(0.97); }
    to { opacity: 1; transform: scale(1); }
}

/* -------------------------------------------------------------
 * 10. Responsive Breakpoints
 * ------------------------------------------------------------- */
@media (max-width: 992px) {
    /* Collapse sidebar to toggleable panel */
    .app-sidebar {
        left: calc(-1 * var(--sidebar-width));
    }
    
    .app-sidebar.show {
        left: 0;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .btn-toggle-sidebar {
        display: block;
    }
}

@media (max-width: 576px) {
    .app-topbar {
        padding: 0 16px;
    }
    .app-content {
        padding: 16px;
    }
    .topbar-clock {
        display: none; /* Hide clock on small mobile to save space */
    }
    .login-card {
        padding: 24px;
    }
}
