/* ===== AutoGest - Custom styles (Bootstrap 5 complement) ===== */

:root {
    --sidebar-width: 250px;
}

/* ===== THEME ===== */
.theme-toggle {
    color: var(--bs-body-color);
    text-decoration: none;
    border: none;
}
.theme-toggle:hover {
    color: var(--bs-primary);
}

.top-navbar {
    background: var(--bs-body-bg) !important;
}

/* Login bg */
.login-page-bg {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}
[data-bs-theme="dark"] .login-page-bg {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-box {
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ===== DARK THEME OVERRIDES ===== */
[data-bs-theme="dark"] {
    --bs-body-bg: #111827;
    --bs-tertiary-bg: #1f2937;
}

[data-bs-theme="dark"] .sidebar {
    background: #1f2937 !important;
}

[data-bs-theme="dark"] .sidebar .border-secondary {
    border-color: #374151 !important;
}

[data-bs-theme="dark"] .sidebar .nav-link {
    color: #9ca3af !important;
}

[data-bs-theme="dark"] .sidebar .nav-link:hover {
    color: #fff !important;
    background: rgba(255,255,255,0.05) !important;
}

[data-bs-theme="dark"] .sidebar .nav-link.active {
    color: #fff !important;
    background: #3b82f6 !important;
}

[data-bs-theme="dark"] .sidebar .sidebar-header a,
[data-bs-theme="dark"] .sidebar .text-white {
    color: #f3f4f6 !important;
}

[data-bs-theme="dark"] .top-navbar {
    background: #1f2937 !important;
    border-color: #374151 !important;
}

[data-bs-theme="dark"] #page-content-wrapper {
    background-color: #111827;
}

[data-bs-theme="dark"] .card {
    background: #1f2937;
    border-color: #374151;
}

[data-bs-theme="dark"] .card-header {
    background: #1f2937 !important;
    border-color: #374151 !important;
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-hover-bg: rgba(255,255,255,0.02);
    color: #e5e7eb;
}

[data-bs-theme="dark"] .table-light {
    --bs-table-bg: #283141;
    --bs-table-border-color: #374151;
    color: #9ca3af;
}

[data-bs-theme="dark"] .table-success {
    --bs-table-bg: rgba(22, 163, 74, 0.08);
}

[data-bs-theme="dark"] .table-danger {
    --bs-table-bg: rgba(239, 68, 68, 0.08);
}

[data-bs-theme="dark"] .table-warning {
    --bs-table-bg: rgba(217, 119, 6, 0.08);
}

[data-bs-theme="dark"] .bg-light {
    background-color: #283141 !important;
}

[data-bs-theme="dark"] .bg-white {
    background-color: #1f2937 !important;
}

[data-bs-theme="dark"] .border,
[data-bs-theme="dark"] .border-bottom {
    border-color: #374151 !important;
}

[data-bs-theme="dark"] .form-control,
[data-bs-theme="dark"] .form-select {
    background-color: #111827;
    border-color: #374151;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-select:focus {
    background-color: #111827;
    border-color: #3b82f6;
    color: #f3f4f6;
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.15);
}

[data-bs-theme="dark"] .form-control::placeholder {
    color: #6b7280;
}

[data-bs-theme="dark"] .input-group-text {
    background-color: #283141;
    border-color: #374151;
    color: #9ca3af;
}

[data-bs-theme="dark"] .modal-content {
    background-color: #1f2937;
    border-color: #374151;
}

[data-bs-theme="dark"] .modal-header,
[data-bs-theme="dark"] .modal-footer {
    border-color: #374151;
}

[data-bs-theme="dark"] .badge.bg-light {
    background-color: #374151 !important;
    color: #e5e7eb !important;
}

[data-bs-theme="dark"] .text-muted {
    color: #6b7280 !important;
}

[data-bs-theme="dark"] .text-dark {
    color: #e5e7eb !important;
}

[data-bs-theme="dark"] .btn-outline-secondary {
    border-color: #4b5563;
    color: #9ca3af;
}

[data-bs-theme="dark"] .btn-outline-secondary:hover {
    background-color: #374151;
    border-color: #4b5563;
    color: #f3f4f6;
}

[data-bs-theme="dark"] .progress {
    background-color: #374151;
}

[data-bs-theme="dark"] .list-group-item {
    background-color: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

[data-bs-theme="dark"] .shadow-sm {
    box-shadow: 0 1px 4px rgba(0,0,0,0.4) !important;
}

[data-bs-theme="dark"] .stat-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.5) !important;
}

[data-bs-theme="dark"] .doc-card {
    border-color: #374151;
    background: #1f2937;
}

[data-bs-theme="dark"] .doc-preview {
    background: #111827;
}

[data-bs-theme="dark"] .rating-bar-container {
    background: #374151;
}

[data-bs-theme="dark"] .rating-item {
    border-color: #374151;
}

[data-bs-theme="dark"] .alert-warning {
    background-color: rgba(217, 119, 6, 0.1);
    border-color: rgba(217, 119, 6, 0.3);
    color: #fbbf24;
}

[data-bs-theme="dark"] .alert-success {
    background-color: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.3);
    color: #4ade80;
}

[data-bs-theme="dark"] .alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar .nav-link {
    padding: 10px 16px;
    font-size: 14px;
    opacity: 0.85;
}

.sidebar .nav-link:hover {
    opacity: 1;
    background: rgba(255,255,255,0.1);
}

.sidebar .nav-link.active {
    opacity: 1;
}

#page-content-wrapper {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    transition: margin-left 0.3s ease;
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    #page-content-wrapper {
        margin-left: 0;
        width: 100%;
    }
}

/* ===== SIDEBAR OVERLAY (mobile) ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}

.sidebar-overlay.show {
    display: block;
}

/* ===== LOGIN PAGE ===== */
.login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ===== STAT CARDS ===== */
.stat-card {
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15) !important;
}

/* ===== RATINGS ===== */
.rating-summary {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 24px;
    padding: 16px 0;
}

.rating-overall {
    text-align: center;
    padding: 16px;
    border-right: 1px solid #dee2e6;
}

.rating-big-number {
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.rating-big-stars {
    font-size: 20px;
    margin-bottom: 4px;
}

.rating-categories {
    display: flex;
    flex-direction: column;
    gap: 10px;
    justify-content: center;
}

.rating-category-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.rating-cat-label {
    font-size: 13px;
    min-width: 190px;
}

.rating-bar-container {
    flex: 1;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.rating-bar {
    height: 100%;
    background: #f59e0b;
    border-radius: 4px;
}

.rating-cat-value {
    font-size: 13px;
    font-weight: 600;
    min-width: 30px;
    text-align: right;
}

.rating-item {
    padding: 12px 16px;
    border: 1px solid #f1f3f5;
    border-radius: 8px;
    margin-bottom: 8px;
}

.rating-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.rating-item-date {
    font-size: 12px;
    color: #adb5bd;
    margin-left: auto;
}

.rating-item-comment {
    font-size: 13px;
    color: #6c757d;
    margin-top: 6px;
}

/* Stars */
.star.full { color: #f59e0b; }
.star.half { color: #f59e0b; opacity: 0.6; }
.star.empty { color: #dee2e6; }

.star-rating-input {
    display: flex;
    align-items: center;
    padding: 8px 0;
}

.star-btn {
    font-size: 32px;
    color: #dee2e6;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}

.star-btn:hover,
.star-btn.hover {
    color: #fbbf24;
    transform: scale(1.2);
}

.star-btn.active {
    color: #f59e0b;
}

/* ===== PROFILE HEADER ===== */
.profile-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #dee2e6;
}

.profile-photo-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--bs-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
}

.profile-photo-container {
    position: relative;
    flex-shrink: 0;
}

.profile-photo-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    background: white;
    border: 2px solid #dee2e6;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.profile-photo-edit:hover {
    border-color: var(--bs-primary);
    transform: scale(1.1);
}

/* ===== DOCUMENTS GALLERY ===== */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.doc-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.doc-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.doc-preview {
    height: 140px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer;
}

.doc-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.doc-pdf-icon {
    font-size: 36px;
    color: #6c757d;
}

.doc-info {
    padding: 10px 12px;
}

.doc-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    background: #e7f1ff;
    color: #0d6efd;
    margin-bottom: 4px;
}

.doc-name {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.doc-desc {
    font-size: 11px;
    color: #6c757d;
}

.doc-meta {
    font-size: 11px;
    color: #adb5bd;
}

.doc-actions {
    padding: 8px 12px;
    border-top: 1px solid #f1f3f5;
    display: flex;
    gap: 6px;
}

/* Document Viewer */
.doc-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 20px;
}

.doc-viewer-content {
    max-width: 90vw;
    max-height: 90vh;
    position: relative;
}

.doc-viewer-content img {
    max-width: 90vw;
    max-height: 85vh;
    border-radius: 8px;
}

.doc-viewer-content iframe {
    width: 80vw;
    height: 85vh;
    border: none;
    border-radius: 8px;
}

.doc-viewer-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 20px;
    cursor: pointer;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 767.98px) {
    .rating-summary {
        grid-template-columns: 1fr;
    }
    .rating-overall {
        border-right: none;
        border-bottom: 1px solid #dee2e6;
    }
    .rating-cat-label {
        min-width: 100px;
        font-size: 11px;
    }
    .documents-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    .profile-photo, .profile-photo-placeholder {
        width: 70px;
        height: 70px;
        font-size: 24px;
    }
}
