/**
 * Service Manual Management System 2026 - B.Grimm Air Conditioning
 * Modern Enterprise Design System & SaaS Stylesheet
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300..800;1,300..800&family=Prompt:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

:root {
    --font-sans: 'Plus Jakarta Sans', 'Prompt', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    
    /* Orange & White Enterprise Palette */
    /* CMYK: 4/74/84/0 | RGB: 233/105/61 -> #e9693d */
    /* CMYK: 0/0/0/0   | RGB: 255/255/255 -> #ffffff */
    --primary: #e9693d;
    --primary-hover: #d2562b;
    --primary-light: #fef2ec;
    --primary-glow: rgba(233, 105, 61, 0.28);
    
    --accent: #f97316;
    --accent-hover: #ea580c;
    --accent-light: #fff7ed;
    
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;

    /* Light Mode Surface Colors */
    --bg-body: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    --bg-subtle: #f1f5f9;
    --border-subtle: #e2e8f0;
    --border-focus: #93c5fd;
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-subtle: #94a3b8;
    
    --sidebar-bg: #0b1528;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: linear-gradient(135deg, #e9693d, #ff8a5c);
    --sidebar-active-text: #ffffff;
    --sidebar-border: rgba(255, 255, 255, 0.08);

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 12px -2px rgba(0,0,0,0.06), 0 2px 6px -1px rgba(0,0,0,0.03);
    --shadow-lg: 0 12px 28px -6px rgba(0,0,0,0.08), 0 6px 14px -3px rgba(0,0,0,0.04);
    --shadow-glow: 0 0 25px var(--primary-glow);

    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --bg-body: #0b111e;
    --bg-surface: #111a2e;
    --bg-surface-elevated: #16223b;
    --bg-subtle: #1a2742;
    --border-subtle: #233354;
    --border-focus: #fb923c;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-subtle: #64748b;
    
    --sidebar-bg: #070c16;
    --sidebar-border: rgba(255, 255, 255, 0.05);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 14px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 30px rgba(0,0,0,0.5);
    
    --primary-light: rgba(233, 105, 61, 0.25);
    --accent-light: rgba(249, 115, 22, 0.2);
}

/* Global Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-main);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

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

a:hover {
    color: var(--accent);
}

/* App Layout Grid */
.app-container {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Sidebar Styles */
.app-sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1040;
    transition: transform var(--transition-normal);
}

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

.sidebar-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

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

.sidebar-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: #475569;
    margin: 18px 12px 8px;
}

.nav-link-custom {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: var(--radius-md);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition-fast);
    margin-bottom: 4px;
}

.nav-link-custom i, .nav-link-custom svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-link-custom:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    transform: translateX(4px);
}

.nav-link-custom.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 72, 143, 0.4);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Main Content Area */
.app-main {
    margin-left: 280px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

/* Header / Navbar */
.app-header {
    height: 72px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1030;
    backdrop-filter: blur(12px);
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Page Body */
.app-content {
    padding: 32px;
    flex: 1;
}

/* Cards */
.card-custom {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    overflow: hidden;
}

.card-custom:hover {
    box-shadow: var(--shadow-md);
}

.card-header-custom {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
}

.card-body-custom {
    padding: 24px;
}

/* KPI Card */
.kpi-card {
    position: relative;
    overflow: hidden;
    padding: 24px;
    border-radius: var(--radius-lg);
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

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

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    color: var(--text-main);
    line-height: 1.1;
}

.kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.kpi-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Buttons */
.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    border: none;
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 12px rgba(233, 105, 61, 0.28);
}

.btn-primary-custom:hover {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-hover), var(--accent-hover));
    box-shadow: 0 6px 18px rgba(233, 105, 61, 0.38);
    transform: translateY(-1px);
}

.btn-outline-custom {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all var(--transition-fast);
}

.btn-outline-custom:hover {
    background: var(--bg-subtle);
    border-color: var(--text-subtle);
    color: var(--text-main);
}

/* Badges */
.badge-status {
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.badge-status.active {
    background: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-status.inactive {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-status.draft {
    background: var(--warning-light);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Form Controls */
.form-label-custom {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    display: block;
}

.form-control-custom, .form-select-custom {
    width: 100%;
    padding: 11px 16px;
    font-size: 14px;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    color: var(--text-main);
    outline: none;
    transition: all var(--transition-fast);
}

.form-control-custom:focus, .form-select-custom:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Modern File Upload Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    background: var(--bg-subtle);
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-dropzone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Tables */
.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom th {
    padding: 14px 18px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
    background-color: var(--bg-subtle);
}

.table-custom td {
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 14px;
    vertical-align: middle;
}

.table-custom tbody tr:hover td {
    background-color: rgba(0, 72, 143, 0.02);
}

/* Scanner Mobile Page Styling */
.scanner-page {
    background: linear-gradient(180deg, #f0f4f8 0%, #ffffff 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.scanner-hero {
    background: linear-gradient(135deg, #c74d23 0%, #e9693d 50%, #ff8a5c 100%);
    color: #ffffff;
    padding: 36px 20px 60px;
    border-bottom-left-radius: 36px;
    border-bottom-right-radius: 36px;
    box-shadow: 0 10px 30px rgba(233, 105, 61, 0.3);
    text-align: center;
    position: relative;
}

.scanner-card {
    max-width: 540px;
    margin: -36px auto 40px;
    padding: 0 16px;
    width: 100%;
}

/* Print Sticker Template */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .no-print {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }
    .app-sidebar, .app-header {
        display: none !important;
    }
    .app-main {
        margin-left: 0 !important;
    }
}

/* Responsive adjustments */
@media (max-width: 991px) {
    .app-sidebar {
        transform: translateX(-100%);
    }
    .app-sidebar.show {
        transform: translateX(0);
    }
    .app-main {
        margin-left: 0;
    }
    .app-header {
        padding: 0 16px;
    }
    .app-content {
        padding: 20px 16px;
    }
}
