/* ==========================================================================
   SERVISMASTEROS — "GARAGE INDUSTRIAL" DIZAJN SISTEM
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-color: #f4f1ec;
    --bg-subtle: #ebe7e0;
    --card-bg: #ffffff;
    --card-border: #e5e1d8;
    --card-border-hover: #d4cdc0;
    --text-primary: #1a1a1a;
    --text-secondary: #404040;
    --text-muted: #6b6b6b;
    --text-inverse: #ffffff;
    --accent: #d97706;
    --accent-hover: #b45309;
    --accent-soft: #fef3c7;
    --accent-soft-border: #fcd34d;
    --success: #15803d;
    --success-soft: #dcfce7;
    --warning: #ca8a04;
    --warning-soft: #fef9c3;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --info: #1e40af;
    --info-soft: #dbeafe;
    --gray-50: #fafaf9;
    --gray-100: #f5f5f4;
    --gray-200: #e7e5e4;
    --gray-300: #d6d3d1;
    --gray-400: #a8a29e;
    --gray-500: #78716c;
    --gray-700: #44403c;
    --gray-900: #1c1917;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;
    --radius-xl: 14px;
    --shadow-xs: 0 1px 2px rgba(28, 25, 23, 0.04);
    --shadow-sm: 0 1px 3px rgba(28, 25, 23, 0.08), 0 1px 2px rgba(28, 25, 23, 0.04);
    --shadow-card: 0 1px 3px rgba(28, 25, 23, 0.06), 0 4px 12px rgba(28, 25, 23, 0.04);
    --shadow-dropdown: 0 4px 16px rgba(28, 25, 23, 0.12);
    --shadow-focus: 0 0 0 3px rgba(217, 119, 6, 0.15);
    --transition-fast: 120ms ease;
    --transition-base: 200ms ease;
}

[data-theme="dark"] {
    --bg-color: #14110f;
    --bg-subtle: #1c1815;
    --card-bg: #1f1b18;
    --card-border: #2d2825;
    --card-border-hover: #3d3632;
    --text-primary: #f5f1ec;
    --text-secondary: #d6d0c8;
    --text-muted: #a8a29e;
    --text-inverse: #14110f;
    --accent: #f59e0b;
    --accent-hover: #fbbf24;
    --accent-soft: #422006;
    --success: #22c55e;
    --success-soft: #14532d;
    --danger: #ef4444;
    --danger-soft: #450a0a;
}

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-font-smoothing: antialiased;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    min-height: 100vh;
    padding: 16px;
    max-width: 720px;
    margin: 0 auto;
    transition: background-color var(--transition-base), color var(--transition-base);
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.125rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 600; }
p { color: var(--text-secondary); }
a { color: var(--accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--accent-hover); }

code, .mono, .plate-tag, .kpi-value, .order-number {
    font-family: var(--font-mono);
    font-feature-settings: "tnum", "zero";
}

/* HEADER */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0 16px 0;
    border-bottom: 2px solid var(--card-border);
    margin-bottom: 18px;
    gap: 16px;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1 1 auto;
    min-width: 0;
}

.brand-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--card-bg);
    padding: 4px;
    border: 1px solid var(--card-border);
}

.brand-text-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex-shrink: 1;
    gap: 2px;
}

.brand-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-width: 0;
}

.brand-title-row h1 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}

.brand-subtext-img {
    height: 20px;
    object-fit: contain;
    align-self: flex-start;
    opacity: 0.7;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: var(--accent-soft);
    color: var(--accent);
    border: 1px solid var(--accent-soft-border);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    flex-shrink: 0;
    white-space: nowrap;
}

header button,
header .btn-secondary,
.header-logout-btn {
    width: auto !important;
    min-width: 72px;
    height: 34px;
    padding: 0 14px;
    margin: 0;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    background-color: transparent;
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

header button:hover,
header .btn-secondary:hover,
.header-logout-btn:hover {
    color: var(--danger);
    border-color: var(--danger);
    background-color: var(--danger-soft);
}

/* NAV */
.nav-links {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    padding: 4px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    box-shadow: var(--shadow-sm);
}

.nav-links::-webkit-scrollbar { display: none; }

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    min-width: 0;
    padding: 9px 10px;
    background-color: transparent;
    border: none;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
    transition: all var(--transition-fast);
}

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

.nav-link.active {
    color: var(--text-inverse);
    background-color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* KARTICE */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    padding: 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    position: relative;
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
    border-color: var(--card-border-hover);
}

.card h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* FORME */
.form-group { margin-bottom: 16px; }

label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.01em;
}

input,
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    background-color: var(--card-bg);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

input::placeholder,
textarea::placeholder { color: var(--gray-400); }

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: var(--shadow-focus);
}

textarea { resize: vertical; min-height: 88px; line-height: 1.5; }

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b6b6b' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* DUGMAD */
button { font-family: var(--font-sans); cursor: pointer; }

button.btn-primary {
    width: 100%;
    padding: 13px 20px;
    background-color: var(--accent);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 8px;
    box-shadow: var(--shadow-sm);
}

button.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: var(--shadow-card);
    transform: translateY(-1px);
}

button.btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

button.btn-secondary {
    width: 100%;
    padding: 11px 16px;
    background-color: transparent;
    color: var(--text-secondary);
    border: 1.5px solid var(--card-border);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 6px;
    transition: all var(--transition-fast);
}

button.btn-secondary:hover {
    color: var(--text-primary);
    border-color: var(--accent);
    background-color: var(--accent-soft);
}

/* STATUS ALERT */
.status-alert {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: none;
    font-size: 0.86rem;
    font-weight: 500;
    white-space: pre-line;
    border-left: 4px solid;
    line-height: 1.5;
}

.status-alert.success {
    display: block;
    background-color: var(--success-soft);
    color: var(--success);
    border-left-color: var(--success);
}

.status-alert.error {
    display: block;
    background-color: var(--danger-soft);
    color: var(--danger);
    border-left-color: var(--danger);
}

/* UTILITY */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }

@media (max-width: 540px) {
    body { padding: 12px; font-size: 14.5px; }
    h1 { font-size: 1.3rem; }
    .row { grid-template-columns: 1fr; }
    .nav-link { font-size: 0.78rem; padding: 8px 6px; }
    .brand-logo { width: 38px; height: 38px; }
}

/* ==========================================================================
   HEADER DUGMAD — kompaktna (za 4 dugmeta u redu)
   ========================================================================== */
header button,
header .btn-secondary,
.header-logout-btn {
    min-width: auto !important;
    height: 30px !important;
    padding: 0 10px !important;
    font-size: 0.75rem !important;
    font-weight: 600;
    gap: 4px;
}

/* Na mobilnom — još manja */
@media (max-width: 540px) {
    header button,
    header .btn-secondary,
    .header-logout-btn {
        min-width: auto !important;
        height: 28px !important;
        padding: 0 8px !important;
        font-size: 0.7rem !important;
    }
}