/* ============================================================================
   ATTENDANCE SISTEM - Jedinstveni dizajn sistem
   Jedan fajl, koristi se na svim admin stranicama preko <link>.
   ============================================================================ */

:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --text-faint: #94a3b8;

    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;

    --success: #16a34a;
    --success-light: #dcfce7;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #d97706;
    --warning-light: #fef3c7;
    --teal: #0d9488;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.25);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------- HEADER / NAV ---------- */
header.topbar {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    color: #fff;
    padding: 14px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
header.topbar h1 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
header.topbar h1 .badge-role {
    font-size: 11px;
    font-weight: 500;
    background: rgba(255,255,255,0.15);
    padding: 2px 9px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
nav.topnav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}
nav.topnav a {
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    padding: 7px 12px;
    border-radius: 7px;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
nav.topnav a:hover { background: rgba(255,255,255,0.1); color: #fff; }
nav.topnav a.active { background: rgba(255,255,255,0.16); color: #fff; }
nav.topnav a.logout {
    background: #dc2626;
    color: #fff;
    margin-left: 8px;
}
nav.topnav a.logout:hover { background: #b91c1c; }

/* ---------- LAYOUT ---------- */
.container { max-width: 1100px; margin: 28px auto; padding: 0 20px; }
.container.narrow { max-width: 640px; }
.container.wide { max-width: 1200px; }

/* ---------- PANELS / CARDS ---------- */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px 24px;
    margin-bottom: 20px;
}
.panel h2 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}
.panel .panel-hint {
    color: var(--text-muted);
    font-size: 12.5px;
    margin-bottom: 14px;
}

.selector {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 18px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.selector label { font-weight: 600; font-size: 13px; color: var(--text-muted); }

/* ---------- STAT CARDS (dashboard) ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 22px;
}
.stat-card .num { font-size: 30px; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-card .label { color: var(--text-muted); font-size: 13px; margin-top: 8px; }

/* ---------- HERO CARD (colored header, e.g. XML export) ---------- */
.hero-card {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid var(--border);
}
.hero-card .hero-header {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    padding: 22px 26px;
    font-size: 18px;
    font-weight: 700;
}
.hero-card .hero-body { padding: 26px; }

/* ---------- MESSAGES / ALERTS ---------- */
.msg { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13.5px; font-weight: 500; }
.msg.ok { background: var(--success-light); color: #166534; border: 1px solid #bbf7d0; }
.msg.err { background: var(--danger-light); color: #991b1b; border: 1px solid #fecaca; }
.hint {
    background: var(--warning-light);
    border-left: 3px solid var(--warning);
    padding: 11px 15px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: #78350f;
    margin-bottom: 18px;
}
.info-box {
    background: var(--primary-light);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    font-size: 12.5px;
    color: #3730a3;
    margin-bottom: 20px;
    line-height: 1.7;
}
.info-box b { color: #312e81; }

/* ---------- FORMS ---------- */
label { display: block; font-weight: 600; font-size: 12.5px; margin-bottom: 5px; color: var(--text-muted); }
input, select, textarea {
    width: 100%;
    padding: 9px 12px;
    margin-bottom: 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-family: inherit;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.12s;
}
.form-row input, .form-row select, .form-row textarea { margin-bottom: 0; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input[type="file"] { padding: 7px; border-style: dashed; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.form-row.single { grid-template-columns: 1fr; }

.quick-buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.quick-buttons button {
    padding: 6px 12px; background: var(--bg); color: var(--text-muted);
    border: 1px solid var(--border); border-radius: 7px; font-size: 12px; cursor: pointer;
}
.quick-buttons button:hover { background: #e2e8f0; }

/* ---------- BUTTONS ---------- */
button, .btn {
    display: inline-block;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-family: inherit;
    transition: opacity 0.12s, background 0.12s;
}
button:hover, .btn:hover { opacity: 0.92; }
button.btn-primary, .btn-primary, button:not([class*="btn-"]):not(.warn):not(.neutral):not(.users) {
    background: var(--primary); color: #fff;
}
button.btn-primary:hover, .btn-primary:hover { background: var(--primary-dark); opacity: 1; }
.btn-success, button.btn-success { background: var(--success); color: #fff; }
.btn-danger, button.btn-danger, button.warn { background: #ea580c; color: #fff; }
.btn-purple, button.btn-purple { background: #7e22ce; color: #fff; }
.btn-teal, button.btn-teal, button.users { background: var(--teal); color: #fff; }
.btn-neutral, button.neutral { background: var(--primary); color: #fff; }
.btn-gray, button.btn-gray { background: #94a3b8; color: #fff; }
.btn-block { width: 100%; }
.btn-submit-lg {
    width: 100%; padding: 13px; font-size: 14px;
    background: linear-gradient(135deg, var(--primary), #7c3aed); color: #fff;
}

/* ---------- TABLES ---------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
th, td { text-align: left; padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--border); }
th { background: #f8fafc; color: var(--text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge.active { background: var(--success-light); color: #166534; }
.badge.inactive { background: var(--danger-light); color: #991b1b; }
.badge-offline { background: var(--warning-light); color: #78350f; padding: 2px 8px; border-radius: 10px; font-size: 10.5px; margin-left: 6px; }

.small, .text-muted { color: var(--text-faint); font-size: 12px; }

.actions { min-width: 130px; }
.actions .btn-stack { display: flex; flex-direction: column; gap: 6px; }
.actions .btn-stack button, .actions .btn-stack a, .actions .btn-stack form { width: 100%; }
.actions .btn-stack button, .actions .btn-stack a {
    width: 100%; padding: 7px 0; font-size: 12px; text-align: center;
    border-radius: 7px; border: none; cursor: pointer; text-decoration: none; box-sizing: border-box; display: block;
}
.thumb { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; vertical-align: middle; background: var(--bg); }

.edit-row td { background: #f8fafc; padding: 18px; }

/* ---------- EMPTY STATE ---------- */
.empty-state {
    background: var(--surface);
    border: 1px dashed var(--border);
    padding: 44px 20px;
    text-align: center;
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 14px;
}

/* ---------- LOG BOX (monospace output) ---------- */
.log-box {
    background: #0f172a; color: #cbd5e1; padding: 16px; border-radius: var(--radius-sm);
    font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; line-height: 1.7;
}

/* ---------- LOGIN PAGE ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    padding: 20px;
}
.login-box {
    background: var(--surface); width: 100%; max-width: 400px;
    border-radius: 18px; box-shadow: var(--shadow-lg); overflow: hidden;
}
.login-box .login-header {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff; padding: 30px 20px; text-align: center;
}
.login-box .login-header h1 { font-size: 20px; font-weight: 700; }
.login-box .login-body { padding: 30px; }
.login-box button { width: 100%; padding: 12px; font-size: 14.5px; }

/* ---------- LANDING PAGE ---------- */
.landing-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #0f172a; padding: 20px;
}
.landing-card { width: 100%; max-width: 900px; border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-lg); }
.landing-card img { width: 100%; display: block; aspect-ratio: 1024/512; object-fit: cover; }
.landing-body { padding: 40px 40px 48px; text-align: center; background: linear-gradient(180deg, #0f172a, #1e293b); }
.landing-body h1 { color: #fff; font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.landing-body p { color: #94a3b8; font-size: 14px; margin-bottom: 26px; }
.landing-btn {
    display: inline-block; padding: 13px 34px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff; text-decoration: none; border-radius: 10px; font-weight: 700; font-size: 14px;
}
.landing-btn:hover { opacity: 0.9; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 720px) {
    header.topbar { flex-direction: column; align-items: flex-start; }
    .form-row, .form-row.cols-3 { grid-template-columns: 1fr; }
    table, thead, tbody, th, td, tr { display: block; }
    thead { display: none; }
    tr { border-bottom: 2px solid var(--border); padding: 8px 0; }
    td { border-bottom: none; padding: 6px 14px; }
    td:before { content: attr(data-label); font-weight: 600; color: var(--text-muted); display: block; font-size: 11px; text-transform: uppercase; }
}
