/* ============================================================
   NeoTrace.in &mdash; Global Stylesheet
   The Operating System for High-Margin Car Detailing & PPF Studios
   ============================================================ */

/* ----- CSS Custom Properties (Design Tokens) ----- */
:root {
    /* Background & Surface */
    --bg-primary: #06090F;
    --bg-secondary: #080C14;
    --bg-card: #0D1320;
    --bg-card-hover: #141D30;
    --bg-input: #0A0F1C;
    --bg-overlay: rgba(6, 9, 15, 0.9);

    /* Accent Colors */
    --accent-orange: #FF5722;
    --accent-orange-light: rgba(255, 87, 34, 0.15);
    --accent-blue: #38BDF8;
    --accent-blue-light: rgba(56, 189, 248, 0.15);
    --accent-green: #10B981;
    --accent-green-light: rgba(16, 185, 129, 0.15);
    --accent-yellow: #FBBF24;
    --accent-yellow-light: rgba(251, 191, 36, 0.15);
    --accent-red: #EF4444;
    --accent-red-light: rgba(239, 68, 68, 0.15);
    --accent-purple: #A78BFA;
    --accent-purple-light: rgba(167, 139, 250, 0.15);

    /* Text */
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --text-disabled: #475569;

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-hover: rgba(255, 255, 255, 0.12);

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow-orange: 0 0 30px rgba(255, 87, 34, 0.12);
    --shadow-glow-blue: 0 0 30px rgba(56, 189, 248, 0.12);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;

    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-size-xs: 0.6875rem;    /* 11px */
    --font-size-sm: 0.75rem;      /* 12px */
    --font-size-base: 0.875rem;   /* 14px */
    --font-size-md: 1rem;         /* 16px */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 1.875rem;    /* 30px */
    --font-size-4xl: 2.25rem;     /* 36px */

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;

    /* Z-index Scale */
    --z-dropdown: 100;
    --z-sidebar: 200;
    --z-topnav: 300;
    --z-overlay: 400;
    --z-modal: 500;
    --z-toast: 600;

    /* Layout */
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 70px;
    --topnav-height: 56px;
}

/* ----- Reset & Base ----- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-base);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
    position: relative;
    box-sizing: border-box;
}

/* Universal Responsive Table Wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
}

a {
    color: var(--accent-blue);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-orange);
}

img, svg {
    display: block;
    max-width: 100%;
}

.logo-img, .auth-logo-img, .sidebar-brand-img {
    width: 34px !important;
    height: 34px !important;
    max-width: 34px !important;
    max-height: 34px !important;
    object-fit: contain !important;
    border-radius: 6px;
    display: inline-block;
    flex-shrink: 0;
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    border: none;
    outline: none;
    background: none;
}

button {
    cursor: pointer;
}

ul, ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    width: 100%;
}

/* ----- Utility Classes ----- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.text-orange  { color: var(--accent-orange); }
.text-blue    { color: var(--accent-blue); }
.text-green   { color: var(--accent-green); }
.text-yellow  { color: var(--accent-yellow); }
.text-red     { color: var(--accent-red); }
.text-muted   { color: var(--text-secondary); }

.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm       { gap: var(--space-sm); }
.gap-md       { gap: var(--space-md); }
.gap-lg       { gap: var(--space-lg); }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ----- Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 10px 20px;
    font-size: var(--font-size-base);
    font-weight: 600;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    white-space: nowrap;
    line-height: 1.2;
}

.btn-primary {
    background: var(--accent-orange);
    color: #fff;
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: #E64A19;
    box-shadow: var(--shadow-glow-orange);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color-hover);
}

.btn-outline {
    background: transparent;
    color: var(--accent-blue);
    border: 1px solid var(--accent-blue);
}
.btn-outline:hover {
    background: var(--accent-blue-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.btn-sm {
    padding: 6px 14px;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: var(--font-size-md);
}

.btn-block {
    display: flex;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    white-space: normal;
    text-align: center;
    justify-content: center;
    align-items: center;
    word-break: break-word;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

/* ----- Form Inputs ----- */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input,
.form-select,
.form-textarea {
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.1);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ----- Badges ----- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: var(--radius-full);
    line-height: 1.4;
}

.badge-orange  { background: var(--accent-orange-light); color: var(--accent-orange); }
.badge-blue    { background: var(--accent-blue-light);   color: var(--accent-blue); }
.badge-green   { background: var(--accent-green-light);  color: var(--accent-green); }
.badge-yellow  { background: var(--accent-yellow-light); color: var(--accent-yellow); }
.badge-red     { background: var(--accent-red-light);    color: var(--accent-red); }
.badge-purple  { background: var(--accent-purple-light); color: var(--accent-purple); }

/* ----- Cards ----- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: all var(--transition-fast);
}

.card:hover {
    border-color: var(--border-color-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card-title {
    font-size: var(--font-size-md);
    font-weight: 700;
    color: var(--text-primary);
}

/* ----- Toast Notifications ----- */
.toast-container {
    position: fixed;
    top: calc(var(--topnav-height) + 12px);
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: var(--z-toast);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    pointer-events: auto;
    animation: toast-slide-in 0.3s ease;
    min-width: 280px;
    max-width: 420px;
}

.toast-success { border-left: 3px solid var(--accent-green); }
.toast-error   { border-left: 3px solid var(--accent-red); }
.toast-warning { border-left: 3px solid var(--accent-yellow); }
.toast-info    { border-left: 3px solid var(--accent-blue); }

.toast-exit {
    animation: toast-slide-out 0.25s ease forwards;
}

@keyframes toast-slide-in {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-slide-out {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(100%); opacity: 0; }
}

/* ----- Modal ----- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modal-scale-in 0.2s ease;
}

@keyframes modal-scale-in {
    from { transform: scale(0.95); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--border-color);
}

/* ----- Scrollbar ----- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ----- Animations ----- */
@keyframes fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slide-up {
    from { transform: translateY(12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.anim-fade-in { animation: fade-in 0.3s ease; }
.anim-slide-up { animation: slide-up 0.4s ease; }

/* ----- Loading Skeleton ----- */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ----- Responsive Helpers ----- */
@media (max-width: 767px) {
    .hide-mobile { display: none !important; }
    .btn {
        max-width: 100%;
        box-sizing: border-box;
        white-space: normal;
        text-align: center;
        word-break: break-word;
    }
    .btn-block {
        width: 100% !important;
        display: flex !important;
    }
    .btn-lg {
        padding: 12px 16px;
        font-size: var(--font-size-base);
    }
}

@media (min-width: 768px) {
    .hide-desktop { display: none !important; }
}
