/* ============================================================
   Gradnja MVP - Glavni stil
   Paleta: tamno plava/charcoal + construction orange akcent
   ============================================================ */
:root {
    --navy: #101826;
    --navy-light: #1b2536;
    --charcoal: #1e2530;
    --orange: #e8712a;
    --orange-dark: #c95d1c;
    --bg: #f4f5f7;
    --card-bg: #ffffff;
    --border: #e3e6ea;
    --text: #1c222b;
    --text-muted: #6b7480;
    --green: #1a9e63;
    --red: #d94141;
    --blue: #2f6fd6;
    --gray: #8a919c;
    --radius: 6px;
    --shadow: 0 1px 2px rgba(16,24,38,.06), 0 1px 1px rgba(16,24,38,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { margin: 0 0 8px; font-weight: 600; line-height: 1.3; }
p { margin: 0 0 8px; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px;
    background: var(--navy);
    color: #cfd6e0;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}
.sidebar-logo {
    padding: 18px 20px;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; gap: 8px;
}
.sidebar-logo .dot { width: 9px; height: 9px; background: var(--orange); border-radius: 2px; display: inline-block; }
.sidebar nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.sidebar a.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: #b7c0cf;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
}
.sidebar a.nav-link:hover { background: rgba(255,255,255,.05); color: #fff; text-decoration: none; }
.sidebar a.nav-link.active { background: rgba(232,113,42,.12); color: #fff; border-left-color: var(--orange); }
.sidebar-section-label { padding: 14px 20px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: #6f7889; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #8a93a3; }

.main {
    margin-left: 232px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.topbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar-search { flex: 1; max-width: 360px; margin: 0 20px; }
.topbar-search input {
    width: 100%; padding: 7px 12px; border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--bg); font-size: 13px;
}
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.topbar-user .avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--orange); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px;
}
.hamburger { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text); }

.content { padding: 22px 24px 90px; max-width: 1400px; width: 100%; }

/* ---------- Cards ---------- */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    margin-bottom: 18px;
}
.card-title { font-size: 14px; font-weight: 600; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }

/* stat cards */
.stats-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
    background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; box-shadow: var(--shadow);
}
.stat-card .stat-label { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 26px; font-weight: 700; color: var(--navy); }
.stat-card.accent .stat-value { color: var(--orange); }

/* site cards */
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.site-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.site-card h3 { font-size: 14.5px; margin-bottom: 8px; }
.site-card .row { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; color: var(--text-muted); }
.site-card .row strong { color: var(--text); font-weight: 600; }
.progress-bar { background: #eceff2; border-radius: 20px; height: 6px; overflow: hidden; margin: 8px 0; }
.progress-bar .fill { background: var(--orange); height: 100%; border-radius: 20px; }

/* ---------- Badges / Status ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-green { background: #e3f7ec; color: var(--green); }
.badge-red { background: #fbe7e7; color: var(--red); }
.badge-orange { background: #fdedde; color: var(--orange-dark); }
.badge-blue { background: #e8eefc; color: var(--blue); }
.badge-gray { background: #eef0f2; color: var(--gray); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius); border: 1px solid transparent;
    font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); }
.btn-dark { background: var(--navy); color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: #fff; border-color: var(--red); color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }

/* ---------- Forms ---------- */
label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; color: var(--text); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number],
input[type=tel], input[type=file], select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius);
    font-size: 13.5px; font-family: inherit; background: #fff; color: var(--text);
}
textarea { resize: vertical; min-height: 70px; }
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 9px 10px; background: var(--bg); color: var(--text-muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); }
td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:hover td { background: #fafbfc; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--orange); }
.tabs a:hover { text-decoration: none; color: var(--navy); }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); padding: 20px; }
.login-box { background: #fff; border-radius: 10px; padding: 36px 34px; width: 100%; max-width: 380px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login-box h1 { text-align: center; font-size: 19px; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 22px; }
.login-logo { text-align: center; margin-bottom: 14px; font-size: 22px; font-weight: 800; color: var(--navy); }
.login-logo span { color: var(--orange); }

/* ---------- Flash messages ---------- */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; }
.flash-success { background: #e3f7ec; color: var(--green); }
.flash-error { background: #fbe7e7; color: var(--red); }
.flash-info { background: #e8eefc; color: var(--blue); }

/* ---------- Wizard (dnevni izvestaj) ---------- */
.wizard-steps { display: flex; gap: 4px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 4px; }
.wizard-step-dot {
    flex: 1; min-width: 34px; text-align: center; padding: 8px 4px; border-radius: var(--radius);
    background: #eceff2; color: var(--text-muted); font-size: 11px; font-weight: 700; cursor: pointer;
}
.wizard-step-dot.active { background: var(--orange); color: #fff; }
.wizard-step-dot.done { background: var(--navy); color: #fff; }
.wizard-panel { display: none; }
.wizard-panel.active { display: block; }
.item-row { display: grid; grid-template-columns: 2fr 1fr 1fr 2fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.item-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 8px; margin-bottom: 8px; align-items: center; }
.remove-row-btn { background: #fbe7e7; color: var(--red); border: none; border-radius: var(--radius); width: 32px; height: 32px; cursor: pointer; font-weight: 700; }
.add-row-btn { background: none; border: 1px dashed var(--border); color: var(--blue); padding: 8px 14px; border-radius: var(--radius); cursor: pointer; font-size: 13px; font-weight: 600; width: 100%; margin-top: 4px; }
.wizard-nav { display: flex; justify-content: space-between; margin-top: 22px; }
.photo-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px,1fr)); gap: 8px; margin-top: 10px; }
.photo-preview-grid img { width: 100%; height: 90px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); }
.weather-options { display: flex; gap: 8px; flex-wrap: wrap; }
.weather-option { flex: 1; min-width: 90px; }
.weather-option input { display: none; }
.weather-option label { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 8px; text-align: center; cursor: pointer; font-weight: 500; margin: 0; }
.weather-option input:checked + label { border-color: var(--orange); background: #fdedde; color: var(--orange-dark); }

/* ---------- Photo gallery ---------- */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 12px; }
.gallery-item { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #fff; }
.gallery-item img { width: 100%; height: 130px; object-fit: cover; display: block; }
.gallery-item .meta { padding: 8px 10px; font-size: 11.5px; color: var(--text-muted); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.kanban-col { background: #eef0f3; border-radius: var(--radius); padding: 10px; }
.kanban-col h4 { font-size: 12.5px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 10px; letter-spacing: .03em; }
.kanban-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 8px; font-size: 13px; box-shadow: var(--shadow); }
.kanban-card .title { font-weight: 600; margin-bottom: 6px; }
.kanban-card .foot { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--text-muted); }

/* ---------- Mobile bottom nav ---------- */
.bottom-nav { display: none; }
.fab-actions { display: none; }

@media (max-width: 980px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .kanban { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .hamburger { display: block; }
    .topbar-search { display: none; }
    .content { padding: 16px 14px 90px; }
    .bottom-nav {
        display: flex; position: fixed; bottom: 0; left: 0; right: 0; background: #fff;
        border-top: 1px solid var(--border); z-index: 90; padding: 6px 0 8px;
    }
    .bottom-nav a { flex: 1; text-align: center; font-size: 10.5px; color: var(--text-muted); display: flex; flex-direction: column; align-items: center; gap: 3px; }
    .bottom-nav a.active { color: var(--orange); }
    .bottom-nav .icon { font-size: 19px; }
    .fab-actions {
        display: flex; position: fixed; right: 14px; bottom: 70px; z-index: 95;
        background: var(--orange); color: #fff; width: 52px; height: 52px; border-radius: 50%;
        align-items: center; justify-content: center; font-size: 26px; box-shadow: 0 4px 14px rgba(0,0,0,.25);
        text-decoration: none;
    }
    .item-row, .item-row-3 { grid-template-columns: 1fr; }
    .wizard-nav .btn { flex: 1; text-align: center; justify-content: center; }
}

.overlay-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 95; }
.overlay-backdrop.show { display: block; }
