/* ===================================================================
   GCors Client Portal - enterprise tema (light/dark, native)
   =================================================================== */

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

:root {
    --app-sidebar-width: 260px;
    --app-radius: 14px;
    --app-radius-sm: 10px;
    --app-shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
    --app-shadow: 0 4px 16px rgba(15, 23, 42, .08);
    --app-shadow-lg: 0 18px 50px rgba(15, 23, 42, .18);
}

/* ---------- Light tokens ---------- */
[data-bs-theme="light"] {
    --bs-primary: #2563eb;
    --bs-primary-rgb: 37, 99, 235;
    --bs-body-bg: #f3f5fb;
    --bs-body-color: #1e2a3b;
    --bs-secondary-color: #6b7896;
    --bs-tertiary-bg: #ffffff;
    --bs-secondary-bg: #eef1f8;
    --bs-border-color: #e4e8f1;
    --bs-emphasis-color: #0f1b2d;
    --surface: #ffffff;
    --sidebar-bg: #ffffff;
    --topbar-bg: rgba(255, 255, 255, .85);
    --muted: #6b7896;
}

/* ---------- Dark tokens ---------- */
[data-bs-theme="dark"] {
    --bs-primary: #4f86ff;
    --bs-primary-rgb: 79, 134, 255;
    --bs-body-bg: #0b1220;
    --bs-body-color: #dbe2f0;
    --bs-secondary-color: #8a98b5;
    --bs-tertiary-bg: #121c30;
    --bs-secondary-bg: #1a2740;
    --bs-border-color: #243350;
    --bs-emphasis-color: #f2f5fb;
    --surface: #121c30;
    --sidebar-bg: #0d1526;
    --topbar-bg: rgba(13, 21, 38, .82);
    --muted: #8a98b5;
}

* { -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    min-height: 100vh;
    letter-spacing: -0.01em;
}

a { text-decoration: none; }

.btn { --bs-btn-border-radius: 10px; font-weight: 600; }
.btn-lg { --bs-btn-border-radius: 12px; }
.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: color-mix(in srgb, var(--bs-primary) 88%, #000);
    --bs-btn-hover-border-color: color-mix(in srgb, var(--bs-primary) 88%, #000);
    --bs-btn-active-bg: color-mix(in srgb, var(--bs-primary) 80%, #000);
    box-shadow: 0 6px 18px color-mix(in srgb, var(--bs-primary) 30%, transparent);
}

.form-control, .form-select {
    --bs-border-radius: 10px;
    background-color: var(--surface);
    border-color: var(--bs-border-color);
    padding: .6rem .85rem;
}
.form-control:focus, .form-select:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 .2rem rgba(var(--bs-primary-rgb), .18);
}
.form-control::placeholder { color: var(--muted); }
.form-label { font-weight: 600; font-size: .82rem; color: var(--muted); margin-bottom: .35rem; }

/* ---------- Cards ---------- */
.card {
    --bs-card-border-radius: var(--app-radius);
    --bs-card-border-color: var(--bs-border-color);
    --bs-card-bg: var(--surface);
    --bs-card-cap-bg: transparent;
    --bs-card-spacer-x: 1.5rem;
    --bs-card-spacer-y: 1.5rem;
    box-shadow: var(--app-shadow-sm);
}
.card-header {
    border-bottom-color: var(--bs-border-color);
    padding-top: 1.15rem;
    padding-bottom: 1.15rem;
}
.card-title { font-weight: 700; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.app-sidebar {
    width: var(--app-sidebar-width);
    flex-shrink: 0;
    /* Konstantan navy sidebar u obe teme (premium enterprise stil) */
    background-color: #0c1530;
    color: #c7d2e8;
    border-right: 1px solid rgba(255, 255, 255, .06);
    display: flex;
    flex-direction: column;
    padding: 0;
}

.app-sidebar__brand {
    height: 64px; /* poravnato sa topbar visinom */
    margin: 0 0 .5rem;
    padding: 0 1.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    /* Plava header traka preko cele sirine - logo ("Cors" je beo) cita se u obe teme */
    background: linear-gradient(120deg, #1e3a8a 0%, #122a63 55%, #0c1530 100%);
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.app-sidebar__brand img { display: block; width: 104px; height: auto; }
.app-sidebar__descr {
    font-size: .58rem;
    color: rgba(255, 255, 255, .7);
    margin-top: .2rem;
    text-transform: uppercase;
    letter-spacing: .16em;
    font-weight: 700;
}

.app-menu__label {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: rgba(255, 255, 255, .42);
    font-weight: 700;
    padding: .5rem 1.5rem;
    margin-top: .25rem;
}

.app-menu .nav-link {
    display: flex;
    align-items: center;
    gap: .8rem;
    color: #c7d2e8;
    padding: .7rem 1.5rem;
    margin: .1rem .75rem;
    border-radius: var(--app-radius-sm);
    font-weight: 600;
    font-size: .92rem;
    transition: background-color .15s ease, color .15s ease;
}
.app-menu .nav-link i { font-size: 1.15rem; width: 1.3rem; text-align: center; opacity: .85; }
.app-menu .nav-link:hover { background-color: rgba(255, 255, 255, .07); color: #fff; }
.app-menu .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, var(--bs-primary), color-mix(in srgb, var(--bs-primary) 70%, #7c3aed));
    box-shadow: 0 8px 20px color-mix(in srgb, var(--bs-primary) 35%, transparent);
}
.app-menu .nav-link.active i { opacity: 1; }

.app-main { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }

.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.75rem;
    height: 64px; /* poravnato sa brand trakom */
    background-color: var(--topbar-bg);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--bs-border-color);
}
.app-topbar__title { font-weight: 700; font-size: 1.05rem; }

.app-content { flex: 1 1 auto; padding: 1.9rem; width: 100%; max-width: 1640px; margin: 0 auto; }
@media (min-width: 1640px) { .app-content { padding: 2.2rem 2.6rem; } }

/* Kartice koje sadrze samo formu - ne sirimo input preko celog ekrana */
.card-narrow { max-width: 860px; }

.app-footer {
    padding: 1.1rem 1.9rem;
    border-top: 1px solid var(--bs-border-color);
    color: var(--muted);
    font-size: .82rem;
}

/* Topbar user chip */
.user-chip {
    display: flex; align-items: center; gap: .6rem;
    padding: .35rem .6rem .35rem .4rem;
    border-radius: 999px;
    border: 1px solid var(--bs-border-color);
    background: var(--surface);
}
.user-chip__avatar {
    width: 34px; height: 34px; border-radius: 999px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--bs-primary), #7c3aed);
    color: #fff; font-weight: 700; font-size: .85rem;
}
.user-chip__name { font-weight: 600; font-size: .85rem; line-height: 1.1; }
.user-chip__role { font-size: .72rem; color: var(--muted); }

.icon-btn {
    width: 40px; height: 40px; border-radius: 10px;
    display: grid; place-items: center;
    border: 1px solid var(--bs-border-color);
    background: var(--surface);
    color: var(--bs-body-color);
    font-size: 1.1rem;
}
.icon-btn:hover { background: var(--bs-secondary-bg); }

/* ---------- Page heading ---------- */
.page-heading { margin-bottom: 1.5rem; }
.page-heading h1 { font-size: 1.45rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
.page-heading p { color: var(--muted); margin: .25rem 0 0; font-size: .9rem; }
.section-heading { text-transform: uppercase; font-weight: 800; font-size: .8rem; letter-spacing: .08em; color: var(--muted); margin-bottom: 1.1rem; }

/* ---------- Stat cards ---------- */
.stat-card {
    border: none !important;
    border-radius: var(--app-radius);
    color: #fff;
    overflow: hidden;
    position: relative;
    box-shadow: var(--app-shadow);
}
.stat-card .card-body { padding: 1.4rem 1.5rem; }
.stat-card .stat-label { font-size: .8rem; font-weight: 600; opacity: .9; text-transform: uppercase; letter-spacing: .05em; }
.stat-card .stat-value { font-size: 2.1rem; font-weight: 800; line-height: 1; margin-top: .6rem; }
.stat-card .stat-sub { font-size: .78rem; opacity: .85; margin-top: .5rem; }
.stat-card .stat-icon {
    position: absolute; top: 1.2rem; right: 1.3rem;
    width: 46px; height: 46px; border-radius: 12px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .18);
    font-size: 1.4rem;
}
.stat-grad-1 { background: linear-gradient(135deg, #2563eb, #4f46e5); }
.stat-grad-2 { background: linear-gradient(135deg, #0ea5e9, #06b6d4); }
.stat-grad-3 { background: linear-gradient(135deg, #f59e0b, #f97316); }
.stat-grad-4 { background: linear-gradient(135deg, #10b981, #059669); }
.stat-grad-5 { background: linear-gradient(135deg, #ef4444, #e11d48); }

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th {
    text-transform: uppercase; font-size: .72rem; letter-spacing: .05em;
    color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--bs-border-color);
    padding: .65rem .9rem;
}
.table tbody td { padding: .8rem .9rem; border-bottom: 1px solid var(--bs-border-color); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover tbody tr:hover td { background: var(--bs-secondary-bg); }

.table-action { color: var(--muted); font-size: 1.05rem; }
.table-action:hover { color: var(--bs-primary); }

/* ---------- Badges / status ---------- */
.badge-soft {
    background: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border: 1px solid var(--bs-border-color);
    font-weight: 600;
}

/* ---------- Auth split-screen ---------- */
.auth-wrapper { min-height: 100vh; display: grid; grid-template-columns: 1fr; }
@media (min-width: 992px) { .auth-wrapper { grid-template-columns: 1.05fr .95fr; } }

.auth-aside {
    display: none;
    position: relative;
    padding: 3rem;
    color: #fff;
    background: radial-gradient(1200px 600px at -10% -10%, #4f46e5 0%, transparent 55%),
                radial-gradient(1000px 700px at 110% 120%, #06b6d4 0%, transparent 50%),
                linear-gradient(135deg, #1e3a8a, #111827);
    overflow: hidden;
}
@media (min-width: 992px) { .auth-aside { display: flex; flex-direction: column; } }
.auth-aside__brand img { filter: brightness(0) invert(1); }
.auth-aside__title { font-size: 2.2rem; font-weight: 800; line-height: 1.15; margin: auto 0 1rem; letter-spacing: -.02em; }
.auth-aside__sub { color: rgba(255,255,255,.8); font-size: 1rem; max-width: 30rem; }
.auth-aside__list { list-style: none; padding: 0; margin: 2rem 0 0; }
.auth-aside__list li { display: flex; align-items: center; gap: .7rem; padding: .45rem 0; color: rgba(255,255,255,.92); font-weight: 500; }
.auth-aside__list li i { color: #5eead4; font-size: 1.15rem; }
.auth-aside__glow { position: absolute; width: 380px; height: 380px; border-radius: 50%; background: rgba(255,255,255,.06); bottom: -120px; right: -80px; }

.auth-main { display: flex; flex-direction: column; min-height: 100vh; }
.auth-topbar { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 2rem; }
.auth-topbar .auth-mobile-brand { display: flex; align-items: center; gap: .6rem; background: linear-gradient(135deg, #0c1530, #15294f); padding: .45rem .8rem; border-radius: 10px; }
@media (min-width: 992px) { .auth-topbar .auth-mobile-brand { visibility: hidden; } }
.auth-content { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 1rem 1.5rem 2rem; }
.auth-box { width: 100%; max-width: 430px; }
.auth-box .card { box-shadow: var(--app-shadow-lg); border: 1px solid var(--bs-border-color); }
.auth-footer { padding: 1.25rem 2rem; color: var(--muted); font-size: .8rem; text-align: center; }

.auth-logo__descr { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }

/* ---------- Order / misc ---------- */
.order-total { text-align: right; width: 100%; margin-top: 1.5rem; font-weight: 800; font-size: 1.25rem; }
.row-code { font-weight: 600; color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.stamp { transform: rotate(-8deg); font-size: 1.8rem; font-weight: 800; border: .22rem solid; display: inline-block; text-transform: uppercase; border-radius: .9rem; padding: .25rem 1.1rem; }
.is-approved { color: #10b981; border-color: #10b981; }
.is-draft { color: #94a3b8; border-color: #94a3b8; }

.pass-rules { font-size: .78rem; color: var(--muted); }
.pass-rules li { transition: color .15s ease; }
.pass-rules li.valid { color: var(--bs-success); font-weight: 600; }

/* ---------- CRM CTA baner ---------- */
.crm-cta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem 1.6rem;
    border-radius: var(--app-radius);
    color: #fff;
    background: linear-gradient(120deg, #1e3a8a 0%, #2563eb 55%, #4f46e5 100%);
    box-shadow: var(--app-shadow);
}
.crm-cta__title { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; }
.crm-cta__sub { color: rgba(255, 255, 255, .85); font-size: .92rem; margin-top: .15rem; max-width: 38rem; }
.crm-cta__actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }

.store-badge {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background: #000;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 10px;
    padding: .4rem .95rem;
    min-width: 158px;
    transition: background-color .15s ease;
}
.store-badge:hover { color: #fff; background: #141414; }
.store-badge i { font-size: 1.7rem; line-height: 1; }
.store-badge span { display: flex; flex-direction: column; line-height: 1.15; }
.store-badge small { font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; opacity: .85; }
.store-badge strong { font-size: 1.02rem; font-weight: 700; }

/* ---------- Quill editor (HTML poruka na tiketu) ---------- */
.quill-host { background: #fff; color: #1e2a3b; border-radius: 0 0 8px 8px; }
.quill-host .ql-editor { min-height: 140px; font-size: .95rem; }
.ql-toolbar.ql-snow { border-radius: 8px 8px 0 0; background: #f8f9fc; }

/* ---------- Forma za novi tiket ---------- */
.ticket-new-card .quill-host { border: 1px solid var(--bs-border-color); border-top: 0; }
.ticket-new-card .ql-toolbar.ql-snow { border: 1px solid var(--bs-border-color); }
.ticket-files-list:empty { display: none; }
.ticket-files-list .badge { font-weight: 500; }

/* ---------- Plan kartice ---------- */
.plan-card { transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease; }
.plan-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--app-shadow);
    border-color: var(--bs-primary);
}

/* ---------- reCAPTCHA ----------
   Widget je light tema na svetloj plocici - Google-ov interni #d3d3d3 border
   nema kontrast pa nema bele linije ni u dark ni u light temi. */
.captcha-wrap {
    display: inline-block;
    line-height: 0;
    background: #f9f9f9;
    padding: 6px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--app-shadow-sm);
}

/* ---------- Theme toggle icons ---------- */
[data-bs-theme="light"] .theme-icon-light { display: none; }
[data-bs-theme="dark"] .theme-icon-dark { display: none; }

@media (min-width: 992px) {
    /* Bootstrap offcanvas-lg na desktopu postavlja transparent !important - vracamo navy */
    .app-sidebar.offcanvas-lg {
        transform: none;
        visibility: visible;
        background-color: #0c1530 !important;
    }
}
