/* ============================================================================
   GSelt POS Admin - osnovni stilovi (mobile-first)
   ============================================================================ */

:root {
    --color-bg:          #0f1419;
    --color-surface:     #1a1f26;
    --color-surface-2:   #232a33;
    --color-border:      #2e3742;
    --color-text:        #e6edf3;
    --color-text-dim:    #8b949e;
    --color-accent:      #2f81f7;
    --color-accent-hover:#1f6feb;
    --color-success:     #2ea043;
    --color-danger:      #f85149;
    --color-warning:     #d29922;
    --shadow-card:       0 1px 3px rgba(0, 0, 0, 0.4);
    --radius:            8px;
    --font-stack:        ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }

body {
    font-family: var(--font-stack);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); text-decoration: underline; }

code { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; background: var(--color-surface-2); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.92em; }

h1 { font-size: 1.5rem; margin: 0 0 1rem 0; }
h3 { font-size: 1.1rem; margin: 0 0 0.5rem 0; }

/* Layout (mobile-first) */
.admin-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.admin-sidebar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem;
    overflow-x: auto;
}

.brand { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
/* Sidebar logo + POS badge. Koristi belu varijantu jer je admin tema tamna. */
.brand-logo {
    height: 28px;
    width: auto;
    display: block;
}
.pos-badge {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--color-accent);
    background: rgba(47, 129, 247, 0.12);
    border: 1px solid rgba(47, 129, 247, 0.4);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    line-height: 1;
}
/* Legacy .brand-mark / .brand-name ostavljeno za stranice koje ga jos zovu eksplicitno
   (npr. EmptyLayout fallback ako ikad nema slike). */
.brand-mark {
    background: var(--color-accent);
    color: white;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius);
    font-weight: 700;
    letter-spacing: 1px;
}
.brand-name { font-weight: 600; }

.admin-sidebar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.admin-sidebar nav a {
    display: block;
    padding: 0.5rem 0.9rem;
    border-radius: var(--radius);
    color: var(--color-text);
    white-space: nowrap;
}
.admin-sidebar nav a:hover { background: var(--color-surface-2); text-decoration: none; }
.admin-sidebar .nav-section {
    font-size: 0.7rem;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.75rem 0.9rem 0.25rem;
    list-style: none;
    font-weight: 600;
}

/* Form controls */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--color-text-dim);
}
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.95rem;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--color-accent);
}
.form-row { display: grid; gap: 1rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) { .form-row { grid-template-columns: 1fr; } }

.btn {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
}
.btn-primary { background: var(--color-accent); color: white; }
.btn-primary:hover { background: var(--color-accent-hover); }
.btn-secondary { background: var(--color-surface-2); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-border); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-success { background: var(--color-success); color: white; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.btn + .btn { margin-left: 0.5rem; }

.toolbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; gap: 1rem; }
.toolbar-actions { display: flex; gap: 0.5rem; align-items: center; }
.search-input { width: 280px; max-width: 100%; }

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}
.badge-success { background: rgba(46, 160, 67, 0.2); color: var(--color-success); }
.badge-danger { background: rgba(248, 81, 73, 0.2); color: var(--color-danger); }
.badge-warning { background: rgba(210, 153, 34, 0.2); color: var(--color-warning); }
.badge-info { background: rgba(47, 129, 247, 0.2); color: var(--color-accent); }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    max-width: 720px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
}
.modal-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--color-border);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-body { padding: 1.25rem; }
.modal-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--color-border);
    display: flex; justify-content: flex-end; gap: 0.5rem;
}

.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-dim { color: var(--color-text-dim); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.flex-spacer { flex: 1; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.admin-main { flex: 1; display: flex; flex-direction: column; }
.admin-topbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.topbar-title { font-weight: 600; }
.admin-content { padding: 1.25rem; }

/* Desktop layout */
@media (min-width: 900px) {
    .admin-shell { flex-direction: row; }
    .admin-sidebar {
        width: 240px;
        min-height: 100vh;
        border-right: 1px solid var(--color-border);
        border-bottom: none;
    }
    .admin-sidebar nav ul { flex-direction: column; gap: 0.1rem; }
    .admin-content { padding: 2rem; max-width: 1400px; }
}

/* Cards */
.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    margin-top: 1.5rem;
}
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}
.card h3 { margin-top: 0; }

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    overflow: hidden;
}
.table th, .table td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.table thead th {
    background: var(--color-surface-2);
    color: var(--color-text-dim);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(47, 129, 247, 0.05); }

.empty-state {
    padding: 2rem;
    text-align: center;
    color: var(--color-text-dim);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius);
    margin-top: 1rem;
}

/* ============================================================================
   Dashboard metrics (MetricTile)
   ============================================================================ */
.metric-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    margin: 0.75rem 0 1rem 0;
}
.metric-tile {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    border-left: 3px solid var(--color-border);
}
.metric-tile.metric-success { border-left-color: var(--color-success); }
.metric-tile.metric-warning { border-left-color: var(--color-warning); }
.metric-tile.metric-danger  { border-left-color: var(--color-danger); }
.metric-tile.metric-info    { border-left-color: var(--color-accent); }
.metric-label {
    font-size: 0.78rem;
    color: var(--color-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-weight: 600;
}
.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.metric-sublabel {
    font-size: 0.78rem;
    color: var(--color-text-dim);
}

/* ============================================================================
   Login screen (EmptyLayout)
   ============================================================================ */
.auth-shell {
    min-height: 100vh;
    width: 100%;
    background:
        radial-gradient(circle at 20% 0%, rgba(47, 129, 247, 0.18) 0%, transparent 50%),
        radial-gradient(circle at 80% 100%, rgba(47, 129, 247, 0.10) 0%, transparent 50%),
        var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 2.25rem 2rem;
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.45),
        0 2px 4px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.login-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}
.login-brand .brand-logo {
    height: 52px;
    width: auto;
    display: block;
}
.login-brand .pos-badge {
    font-size: 0.95rem;
    letter-spacing: 2px;
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
}

.login-card h1 {
    font-size: 1.5rem;
    margin: 0 0 0.4rem 0;
    text-align: center;
    font-weight: 600;
}

.login-hint {
    color: var(--color-text-dim);
    text-align: center;
    margin: 0 0 1.5rem 0;
    font-size: 0.92rem;
    line-height: 1.5;
}
.login-hint strong { color: var(--color-text); font-weight: 500; }

.login-card .form-group { margin-bottom: 1.1rem; }
.login-card .form-group input {
    padding: 0.7rem 0.9rem;
    font-size: 1rem;
    background: var(--color-bg);
    border-color: var(--color-border);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card .form-group input:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px rgba(47, 129, 247, 0.18);
}

.btn-block {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.98rem;
    font-weight: 600;
    margin-top: 0.25rem;
}
.btn-block + .btn-block { margin-top: 0.6rem; margin-left: 0; }

/* Scope picker (multi-tenant) */
.scope-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin: 0 0 1rem 0;
}
.scope-tile {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
    text-align: left;
    color: var(--color-text);
    font-family: inherit;
}
.scope-tile:hover {
    background: var(--color-border);
    border-color: var(--color-accent);
}
.scope-tile:active { transform: scale(0.99); }

.scope-tile.scope-system {
    background: linear-gradient(135deg, rgba(47, 129, 247, 0.18) 0%, rgba(47, 129, 247, 0.08) 100%);
    border-color: rgba(47, 129, 247, 0.5);
}
.scope-tile.scope-system:hover {
    background: linear-gradient(135deg, rgba(47, 129, 247, 0.28) 0%, rgba(47, 129, 247, 0.14) 100%);
    border-color: var(--color-accent);
}

.scope-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--color-accent);
}
.scope-tile.scope-system .scope-icon {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.scope-info { flex: 1; min-width: 0; }
.scope-title { font-weight: 600; margin-bottom: 0.15rem; }
.scope-subtitle { font-size: 0.82rem; color: var(--color-text-dim); }

.alert {
    padding: 0.7rem 0.9rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-danger {
    background: rgba(248, 81, 73, 0.12);
    color: var(--color-danger);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

/* Sidebar user footer (logout area) */
.sidebar-footer {
    border-top: 1px solid var(--color-border);
    padding: 0.85rem 0.9rem;
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.user-info { min-width: 0; flex: 1; }
.user-name { font-weight: 500; font-size: 0.9rem; }
.user-scope { margin-top: 0.2rem; font-size: 0.7rem; }
.btn-logout {
    color: var(--color-text-dim);
    padding: 0.35rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
}
.btn-logout:hover {
    background: var(--color-surface-2);
    color: var(--color-danger);
    text-decoration: none;
}
@media (min-width: 900px) {
    .admin-sidebar { display: flex; flex-direction: column; }
    .admin-sidebar nav { flex: 1; }
}
