:root {
    --bg-dark: #0f172a;
    --card-bg: #1e293b;
    --surface-light: #334155;
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --ai-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --success: #10b981;
    --danger: #ef4444;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    
    --radius-md: 12px;
    --radius-lg: 16px;
    --spacing: 16px;
}

/* Osnova za preprečevanje zuma na iOS in boljše pomikanje */
* { box-sizing: border-box; }
body { 
    margin: 0; 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background: var(--bg-dark); 
    color: var(--text-main); 
    /* Dovolj prostora na dnu, da action-bar ne prekrije vsebin */
    padding-bottom: 90px; 
    -webkit-font-smoothing: antialiased;
}

/* Posodobljen Header (Dve vrstici za mobilno napravo) */
.glass-header { 
    display: flex; flex-direction: column; gap: 12px;
    padding: var(--spacing); 
    background: rgba(30, 41, 59, 0.85); 
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border); 
    position: sticky; top: 0; z-index: 50;
}
/* Posodobitev za naslov, da sta slika in tekst v isti liniji */
.glass-header h1 { 
    margin: 0; 
    font-size: 1.15rem; 
    font-weight: 700; 
    display: flex; 
    align-items: center; 
    gap: 10px; 
}

/* Tailwind ekvivalentni razredi za logotip */
.w-8 { width: 2rem; }
.h-8 { height: 2rem; }
.rounded-lg { border-radius: 0.5rem; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.bg-white { background-color: #ffffff; }
.p-0\.5 { padding: 0.125rem; }

@media (min-width: 640px) {
    .sm\:w-10 { width: 2.5rem; }
    .sm\:h-10 { height: 2.5rem; }
}
.header-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.secondary-row { padding-top: 8px; border-top: 1px dashed rgba(255,255,255,0.1); }
.glass-header h1 { margin: 0; font-size: 1.15rem; font-weight: 700; }

.user-controls { display: flex; align-items: center; gap: 12px; }
.user-name { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }
.btn-logout { 
    background: rgba(239, 68, 68, 0.1); color: var(--danger); 
    min-height: 32px; padding: 6px 12px; width: auto; font-size: 0.8rem; border-radius: 6px; 
}

/* GPS Stikalo (Prekopirano in prilagojeno iz stare kode) */
.gps-control { display: flex; align-items: center; gap: 10px; }
#gpsStatusLabel { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border); transition: .3s; border-radius: 24px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--success); }
input:checked + .slider:before { transform: translateX(20px); }
.glass-header h1 { margin: 0; font-size: 1.25rem; font-weight: 700; }

.live-badge { 
    display: flex; align-items: center; gap: 6px; 
    font-size: 0.75rem; font-weight: 800; color: var(--success); 
    background: rgba(16, 185, 129, 0.15); 
    padding: 6px 10px; border-radius: 20px; 
    letter-spacing: 0.5px;
}
.live-badge .dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); } 70% { box-shadow: 0 0 0 5px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }

/* Zavihki (Tabs) */
.glass-tabs {
    display: flex; 
    background: rgba(15, 23, 42, 0.95);
    position: sticky;
    top: 61px; /* Pod headerjem */
    z-index: 40;
    border-bottom: 1px solid var(--border);
}
.tab-btn { 
    flex: 1; padding: 16px; background: none; border: none; 
    color: var(--text-muted); font-size: 0.95rem; font-weight: 600; 
    transition: all 0.2s ease; border-bottom: 3px solid transparent;
}
.tab-btn.active { color: var(--primary); border-bottom: 3px solid var(--primary); background: rgba(59, 130, 246, 0.05); }

/* Vsebina in kartice */
main { padding: var(--spacing); max-width: 600px; margin: 0 auto; }
.mode-section { display: none; } 
.mode-section.active { display: block; animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.card { 
    background: var(--card-bg); 
    border-radius: var(--radius-lg); 
    padding: var(--spacing); 
    margin-bottom: var(--spacing); 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.highlight-card { border: 1px solid rgba(99, 102, 241, 0.3); }

.card h2 { margin: 0 0 8px 0; font-size: 1.1rem; color: var(--text-main); }
.subtitle { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 16px 0; line-height: 1.4; }
.section-title { font-size: 1rem; color: var(--text-muted); margin: 24px 0 12px 4px; text-transform: uppercase; letter-spacing: 0.5px; }
.success-title { color: var(--success); margin: 0 0 16px 0; display: flex; align-items: center; gap: 8px; }

/* Obrazci in vnosna polja (16px minimalno za iOS!) */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500;}
.form-row { display: flex; gap: 12px; } .form-row .form-group { flex: 1; margin-bottom: 0; }

input, select { 
    width: 100%; 
    padding: 14px 16px; 
    background: var(--bg-dark); 
    border: 1px solid var(--border); 
    color: var(--text-main); 
    border-radius: var(--radius-md); 
    font-size: 16px; /* KLJUČNO ZA iOS */
    transition: border-color 0.2s;
    outline: none;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); }
.sscc-input { font-family: ui-monospace, monospace; font-weight: bold; color: #fbbf24; background: rgba(15, 23, 42, 0.5); }
.select-lg { font-weight: bold; }

.input-group { display: flex; gap: 8px; } 
.input-group input { flex: 1; }
.btn-icon-only { width: 54px; padding: 0; flex-shrink: 0; }

/* Gumbi z dodanim Haptic občutkom */
button { 
    width: 100%; 
    min-height: 30px;
    padding: 14px; 
    border: none; 
    border-radius: var(--radius-md); 
    font-size: 1.05rem; 
    font-weight: 600; 
    cursor: pointer; 
    display: flex; justify-content: center; align-items: center; gap: 8px; 
    transition: all 0.15s ease;
    touch-action: manipulation; /* Prepreči double-tap zoom na gumbih */
}
button:active { transform: scale(0.96); } /* Simulacija pritiska */

.btn-primary { background: var(--primary); color: white; box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3); }
.btn-secondary { background: var(--surface-light); color: white; }
.btn-outline { background: transparent; border: 2px solid var(--surface-light); color: var(--text-main); margin-top: 16px; }
.btn-ai { background: var(--ai-grad); color: white; box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4); }
.btn-large { padding: 18px; font-size: 1.15rem; border-radius: var(--radius-lg); }

/* Bottom Action Bar (Thumb Zone fiksiran na dnu) */
.bottom-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 16px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    z-index: 100;
    display: flex;
    justify-content: center;
}
.btn-save { max-width: 600px; border-radius: var(--radius-full); } /* Zaobljen gumb kot na sodobnih aplikacijah */

/* Seznam artiklov */
.items-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.item-row { 
    background: rgba(15, 23, 42, 0.5); 
    padding: 16px; 
    border-radius: var(--radius-md); 
    border: 1px solid var(--border); 
    display: flex; justify-content: space-between; align-items: center; 
}
.item-info strong { display: block; color: var(--text-main); font-size: 1rem; margin-bottom: 4px; } 
.item-info small { color: var(--text-muted); font-size: 0.8rem; }
.item-qty { display: flex; align-items: center; gap: 12px; }
.item-qty strong { font-size: 1.1rem; color: var(--primary); background: rgba(59, 130, 246, 0.1); padding: 4px 8px; border-radius: 6px;}

.empty-state { text-align: center; color: var(--text-muted); padding: 30px 0; font-style: italic; background: rgba(15, 23, 42, 0.3); border-radius: var(--radius-md); border: 1px dashed var(--border); }

/* AI Kartice (Uredljive) */
.ai-item-card { 
    background: rgba(15, 23, 42, 0.7); 
    border: 1px solid var(--border); 
    padding: 16px; 
    border-radius: var(--radius-lg); 
    position: relative; 
    margin-bottom: 12px; 
}
.ai-item-card.error { border-color: var(--danger); background: rgba(239, 68, 68, 0.05); }
.btn-remove-ai { 
    position: absolute; top: -10px; right: -5px; 
    width: 32px; min-height: 32px; padding: 0;
    border-radius: 50%; background: var(--danger); 
    color: white; font-size: 16px; 
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.5); z-index: 10;
}

/* Nalagalni zaslon (Overlay) */
.overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%; 
    background: rgba(15, 23, 42, 0.98); 
    z-index: 9999; 
    display: flex; flex-direction: column; justify-content: center; align-items: center; 
}
.spinner-container { position: relative; margin-bottom: 24px; }
.spinner { font-size: 3rem; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.spinner-ring { 
    width: 100px; height: 100px; 
    border: 4px solid rgba(99, 102, 241, 0.2); 
    border-top: 4px solid var(--primary); 
    border-radius: 50%; 
    animation: spin 1s cubic-bezier(0.5, 0, 0.5, 1) infinite; 
}

/* Galerija slik na paleti */
.image-gallery {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}
.gallery-img {
    height: 120px;
    min-width: 120px;
    object-fit: cover;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.5);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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