/* Custom CSS styles for LPC website */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
}

/* ════════════════════════════════════════════
   SIDEBAR LAYOUT SYSTEM
   ════════════════════════════════════════════ */
:root {
    --sidebar-width: 252px;
    --topbar-height: 56px;
    --sidebar-bg: #1a2332;
    --sidebar-hover: rgba(255,255,255,0.07);
    --sidebar-active: rgba(59,130,246,0.18);
    --sidebar-active-border: #3b82f6;
    --sidebar-text: rgba(255,255,255,0.72);
    --sidebar-section: rgba(255,255,255,0.30);
}

/* --- Sidebar --- */
#lpc-sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1040;
    transition: transform 0.25s ease;
    box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

#lpc-sidebar .sidebar-scroll {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.15) transparent;
}
#lpc-sidebar .sidebar-scroll::-webkit-scrollbar { width: 4px; }
#lpc-sidebar .sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

#lpc-sidebar .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    min-height: var(--topbar-height);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}
#lpc-sidebar .sidebar-brand:hover { color: #fff; opacity: 0.92; }

#lpc-sidebar .sidebar-brand img {
    height: 28px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

#lpc-sidebar .nav-section {
    padding: 0;
}

#lpc-sidebar .nav-section-label {
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--sidebar-section);
    padding: 16px 16px 4px;
    display: block;
    user-select: none;
}

#lpc-sidebar .nav-item-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    color: var(--sidebar-text);
    font-size: 0.845rem;
    border-left: 3px solid transparent;
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 36px;
}
#lpc-sidebar .nav-item-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}
#lpc-sidebar .nav-item-link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--sidebar-active-border);
    font-weight: 600;
}
#lpc-sidebar .nav-item-link .nav-icon {
    width: 16px;
    text-align: center;
    font-size: 0.82rem;
    flex-shrink: 0;
    opacity: 0.85;
}
#lpc-sidebar .nav-item-link .nav-badge {
    margin-left: auto;
    background: #ef4444;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 8px;
    line-height: 1.5;
    flex-shrink: 0;
}

/* --- Top bar --- */
#lpc-topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 20px 0 20px;
    z-index: 1030;
    gap: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
#lpc-topbar .topbar-title {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}
#lpc-topbar .topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}
#lpc-topbar .topbar-divider {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
    margin: 0 4px;
}
#topbar-menu-btn { display: none; }

/* --- Main content --- */
#lpc-main {
    margin-left: var(--sidebar-width);
    padding-top: var(--topbar-height);
    min-height: 100vh;
}
#lpc-main .content-body {
    padding: 24px;
}

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

/* --- Responsive --- */
@media (max-width: 991.98px) {
    #lpc-sidebar { transform: translateX(-100%); }
    #lpc-sidebar.sidebar-open { transform: translateX(0); }
    #sidebar-overlay.show { display: block; }
    #lpc-topbar { left: 0; }
    #lpc-main { margin-left: 0; }
    #topbar-menu-btn { display: inline-flex !important; }
}

/* ────────────────── Card / UI tweaks ────────────────── */
.card {
    border: none;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    transition: box-shadow 0.2s;
}
.card:hover {
    transform: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid #f0f0f0;
    font-weight: 600;
}

/* Page header pattern */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.page-header h2, .page-header h3 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #1a2332;
}

/* Status badge colors */
.badge-status-kreiran    { background:#6c757d; }
.badge-status-odobren    { background:#198754; }
.badge-status-odbacen    { background:#dc3545; }
.badge-status-u_obradi   { background:#0d6efd; }
.badge-status-zavrsen    { background:#20c997; }

/* Table in app context */
.table thead th {
    background: #1a2332;
    color: #fff;
    border: none;
    font-weight: 600;
    font-size: 0.82rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.table { margin-bottom: 0; }


/* Logo styles */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
    transition: opacity 0.3s ease;
}

.navbar-brand:hover {
    opacity: 0.9;
}

.navbar-brand img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

@media (max-width: 768px) {
    .navbar-brand img {
        max-height: 30px;
    }
    .navbar-brand span {
        font-size: 1rem;
    }
}

.jumbotron {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.card {
    transition: transform 0.3s ease-in-out;
    border: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.btn-primary {
    background: linear-gradient(45deg, #007bff, #0056b3);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #0056b3, #004085);
}

.footer {
    background-color: #343a40 !important;
}

/* Form styles */
.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Product grid styles */
.product-card {
    margin-bottom: 30px;
}

.product-image {
    height: 200px;
    object-fit: cover;
}

/* Dashboard styles */
.dashboard-card {
    border-left: 4px solid #007bff;
}

.stats-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .jumbotron {
        padding: 2rem 1rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
}

/* Loading spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Alert styles */
.alert {
    border-radius: 10px;
    border: none;
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

/* Table styles */
.table {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.table thead th {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

/* Bootstrap modal backdrop z-index fix */
.modal-backdrop {
    z-index: 140 !important;
}

/* Ensure Bootstrap modal dialog is above backdrop */
.modal.show {
    z-index: 1050 !important;
}

.modal-dialog {
    z-index: 1060 !important;
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: none;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-content.large {
    max-width: 1000px;
    width: 95%;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 15px;
    top: 10px;
}

.close:hover,
.close:focus {
    color: #000;
}

/* Sample and method styles */
.sample-group {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.samples-list {
    margin-top: 10px;
}

.methods-list {
    margin-left: 20px;
    margin-top: 5px;
}

.methods-list li {
    color: #666;
    font-size: 0.9em;
}

/* Filter form styles */
.filters {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.filter-form {
    display: flex;
    gap: 15px;
    align-items: end;
    flex-wrap: wrap;
}

.filter-form .form-group {
    min-width: 150px;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

/* Summary styles */
.summary {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.stat {
    padding: 10px;
    background-color: white;
    border-radius: 3px;
    border-left: 4px solid #007bff;
}

/* Form layout improvements */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.info-item {
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 3px;
}

/* Parameters grid for results form */
.parameters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.parameter-item {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background-color: #f9f9f9;
}

.parameter-item label {
    font-weight: bold;
    margin-bottom: 5px;
    display: block;
}

.parameter-item input,
.parameter-item select,
.parameter-item textarea {
    width: 100%;
    margin-bottom: 5px;
}

.required {
    color: #dc3545;
}

.param-description,
.param-range {
    font-size: 0.85em;
    color: #666;
    display: block;
    margin-top: 3px;
}

/* Results form specific styles */
.nalog-info {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.metoda-opis {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dee2e6;
}

.results-form {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.existing-results {
    margin-top: 20px;
    padding: 15px;
    background-color: #e9ecef;
    border-radius: 5px;
}
