/*
 * KPD Asistent - Web/PWA UI
 * Stilovi usklađeni s Chrome ekstenzijom (light/dark tema, bez filtera)
 */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --bg-app: #ffffff;
    --bg-header: #ffffff;
    --bg-surface: #f8fafc;
    --bg-surface-hover: #f1f5f9;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --accent-gold: #b45309;
    --success: #10b981;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-hover: #60a5fa;
    --bg-app: #0f172a;
    --bg-header: #1e293b;
    --bg-surface: #1e293b;
    --bg-surface-hover: #334155;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --accent-gold: #fbbf24;
    --success: #34d399;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    width: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
}

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1100px;
    margin: 0 auto;
    background: var(--bg-app);
    box-shadow: 0 24px 60px rgba(0,0,0,0.08);
}

/* Header */
.app-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    gap: 12px;
}

.brand { display: flex; flex-direction: column; }
.brand-title { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.brand-subtitle { font-size: 12px; color: var(--text-muted); font-weight: 500; }

.header-actions { display: flex; gap: 8px; }

.icon-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.icon-button:hover { background: var(--bg-surface-hover); color: var(--text-main); }

/* Main */
.app-main { flex: 1; display: flex; flex-direction: column; background: var(--bg-app); }

.search-wrapper { padding: 16px 20px 0 20px; }
.search-input-container { position: relative; }
.search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
#searchInput {
    width: 100%;
    padding: 12px 12px 12px 40px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    color: var(--text-main);
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    box-shadow: var(--shadow-sm);
}
#searchInput:focus { background: var(--bg-app); border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }

.results-container { flex: 1; overflow-y: auto; padding: 0 0 20px 0; }
.results-list { list-style: none; padding: 0; margin: 0; }
.result-item { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; transition: background 0.1s; gap: 12px; }
.result-item:hover { background: var(--bg-surface); }
.result-main { flex: 1; }
.result-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.badge-code { font-family: monospace; font-weight: 700; color: var(--text-main); background: var(--border); padding: 2px 6px; border-radius: 4px; font-size: 12px; }
.badge-sector { font-size: 10px; text-transform: uppercase; color: var(--text-muted); font-weight: 600; }
.result-name { font-size: 14px; line-height: 1.5; color: var(--text-main); }
mark { background: rgba(251, 191, 36, 0.4); color: inherit; padding: 0 1px; border-radius: 2px; }

.btn-copy { background: transparent; border: 1px solid var(--border); color: var(--text-muted); width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; flex-shrink: 0; }
.btn-copy:hover { background: var(--bg-surface-hover); color: var(--primary); border-color: var(--primary); }
.btn-copy.copied { background: rgba(16, 185, 129, 0.1); color: var(--success); border-color: var(--success); }

.empty-state { padding: 60px 20px; text-align: center; color: var(--text-muted); }
.empty-state p { margin: 0 0 8px 0; }
.empty-state small { opacity: 0.7; }

.app-footer { padding: 12px; text-align: center; border-top: 1px solid var(--border); background: var(--bg-surface); }
.footer-link { font-size: 11px; color: var(--text-muted); text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

@media (max-width: 640px) {
    .app-shell { box-shadow: none; }
}
