/* ============================================================
   Servisni Nalozi SaaS - Custom CSS
   Bootstrap 5 + Dark/Light mode podrška
============================================================ */

/* CSS varijable */
:root {
    --sidebar-width: 260px;
    --sidebar-bg: #1a1d23;
    --sidebar-text: #adb5bd;
    --sidebar-active: #0d6efd;
    --topbar-height: 60px;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    --border-radius: 0.5rem;
    --transition: 0.2s ease;
}

[data-bs-theme="dark"] {
    --bs-body-bg: #0f1117;
    --bs-card-bg: #1a1d23;
    --bs-border-color: #2d3748;
}

/* ============================================================
   BASE
============================================================ */
body {
    font-family: var(--font-family);
    font-size: 0.925rem;
}

/* ============================================================
   AUTH LAYOUT
============================================================ */
.auth-body {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: #fff;
    border-radius: 1rem;
    padding: 2.5rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

[data-bs-theme="dark"] .auth-card {
    background: #1a1d23;
}

.auth-brand .brand-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================
   APP WRAPPER (Sidebar + Content)
============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ============================================================
   SIDEBAR
============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1000;
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar-header {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-weight: 700;
    font-size: 1.05rem;
}

.brand-text {
    line-height: 1.2;
    font-size: 0.875rem;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
}

.nav-section {
    padding: 0.5rem 0.75rem 0.25rem;
}

.nav-section-label {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
}

.sidebar-nav .nav-link {
    color: var(--sidebar-text);
    padding: 0.6rem 0.875rem;
    border-radius: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all var(--transition);
    margin-bottom: 2px;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.07);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar-nav .nav-link i {
    width: 18px;
    flex-shrink: 0;
    font-size: 1rem;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-footer .avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Sidebar overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
}

/* ============================================================
   MAIN CONTENT
============================================================ */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   TOPBAR
============================================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--bs-body-bg, #fff);
    border-bottom: 1px solid var(--bs-border-color, #dee2e6);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.content-area {
    flex: 1;
    padding-top: 1.5rem;
}

/* ============================================================
   CARDS
============================================================ */
.stat-card {
    border: none;
    border-radius: 0.75rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
    margin: 0.5rem 0 0.25rem;
}

.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.825rem;
}

/* ============================================================
   TABLICE
============================================================ */
.table-card {
    border: none;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6c757d;
    border-bottom-width: 1px;
}

/* ============================================================
   BADGES ZA STATUSE
============================================================ */
.badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.3em 0.65em;
}

/* ============================================================
   STATUS HISTORY TIMELINE
============================================================ */
.timeline {
    position: relative;
    padding-left: 1.5rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--bs-border-color, #dee2e6);
}

.timeline-item {
    position: relative;
    padding-bottom: 1.25rem;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -1.25rem;
    top: 0.2rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px currentColor;
}

.timeline-date {
    font-size: 0.75rem;
    color: #6c757d;
}

.timeline-content {
    font-size: 0.875rem;
}

/* ============================================================
   FOTO UPLOAD
============================================================ */
.photo-upload-area {
    border: 2px dashed var(--bs-border-color, #dee2e6);
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.photo-upload-area:hover,
.photo-upload-area.drag-over {
    border-color: var(--bs-primary);
    background: rgba(13, 110, 253, 0.04);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.photo-item {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    aspect-ratio: 1;
    background: #f8f9fa;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-item .photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(220, 53, 69, 0.9);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 0.7rem;
    display: none;
    align-items: center;
    justify-content: center;
}

.photo-item:hover .photo-delete {
    display: flex;
}

/* ============================================================
   PDF PRINT VIEW
============================================================ */
@media print {
    .sidebar, .topbar, .no-print, .btn, .alert { display: none !important; }
    .main-content { margin: 0 !important; }
    .content-area { padding: 0 !important; }
    body { font-size: 11pt; }
    .print-border { border: 1px solid #000 !important; }
    .page-break { page-break-before: always; }
}

.pdf-document {
    max-width: 210mm;
    margin: 0 auto;
    background: #fff;
    padding: 2rem;
    font-size: 0.9rem;
}

.pdf-header {
    border-bottom: 2px solid #0d6efd;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.pdf-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #0d6efd;
}

.pdf-number {
    font-size: 1.2rem;
    font-weight: 600;
}

.pdf-table th {
    background: #f8f9fa;
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* ============================================================
   MOBILE
============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .sidebar-overlay.show {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
}

/* ============================================================
   DARK MODE TWEAKS
============================================================ */
[data-bs-theme="dark"] .sidebar {
    background: #0d0f14;
}

[data-bs-theme="dark"] .auth-card {
    background: #1a1d23;
    color: #e9ecef;
}

[data-bs-theme="dark"] .table-card {
    background: #1a1d23;
}

[data-bs-theme="dark"] .stat-card {
    background: #1a1d23;
}

[data-bs-theme="dark"] .pdf-document {
    background: #1a1d23;
    color: #e9ecef;
}

/* ============================================================
   MISC
============================================================ */
.min-w-0 { min-width: 0; }
.flex-1 { flex: 1; }
.cursor-pointer { cursor: pointer; }

.priority-badge-hitno   { background: #dc3545 !important; }
.priority-badge-visoko  { background: #fd7e14 !important; }
.priority-badge-normalno { background: #0d6efd !important; }
.priority-badge-nisko   { background: #6c757d !important; }

/* Hover animacija na redove tablice */
.table-hover-action tr:hover td { background-color: rgba(13, 110, 253, 0.04); }

/* Order number styling */
.order-number {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 0.9em;
    color: #0d6efd;
    letter-spacing: 0.02em;
}

/* Klikabilne stat kartice */
.hover-lift {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.12) !important;
}
.cursor-pointer { cursor: pointer; }
