/* Shared standalone page styles */
body {
    background: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.navbar {
    background: #2c3e50;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar-brand {
    color: white !important;
    font-weight: 600;
}

.nav-link {
    color: rgba(255,255,255,0.8) !important;
}

.nav-link:hover {
    color: white !important;
}

.nav-link.active {
    color: white !important;
    font-weight: 500;
}

.main-content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    font-weight: 600;
    padding: 15px 20px;
}

.login-required {
    text-align: center;
    padding: 60px 20px;
}

.login-required h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.login-required p {
    color: #7f8c8d;
    margin-bottom: 25px;
}

/* Stats cards */
.stats-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 140px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-card .number {
    font-size: 28px;
    font-weight: 700;
}

.stat-card .label {
    color: #666;
    font-size: 13px;
    margin-top: 4px;
}

.stat-card.primary .number { color: #0d6efd; }
.stat-card.success .number { color: #198754; }
.stat-card.warning .number { color: #fd7e14; }

/* Toast */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10003;
}

.toast-notification {
    padding: 10px 16px;
    border-radius: 6px;
    color: white;
    font-size: 13px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.toast-notification.success { background: #198754; }
.toast-notification.error { background: #dc3545; }
.toast-notification.info { background: #0d6efd; }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #7f8c8d;
}

/* Activity items */
.activity-section {
    margin-bottom: 20px;
}

.activity-section h6 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
    margin-bottom: 15px;
}

.activity-item {
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 10px;
    border-left: 3px solid #3498db;
}

.activity-item .date {
    color: #7f8c8d;
    font-size: 11px;
    margin-top: 4px;
}

/* Nav user section separator */
.nav-user-section {
    border-left: 1px solid rgba(255,255,255,0.2);
    margin-left: 8px;
    padding-left: 8px;
    gap: 4px;
}

@media (max-width: 991.98px) {
    .nav-user-section {
        border-left: none;
        border-top: 1px solid rgba(255,255,255,0.2);
        margin-left: 0;
        padding-left: 0;
        margin-top: 8px;
        padding-top: 8px;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }

    .stats-row {
        gap: 10px;
    }

    .stat-card {
        min-width: 0;
        padding: 14px 10px;
    }

    .stat-card .number {
        font-size: 22px;
    }

    .stat-card .label {
        font-size: 11px;
    }

    .card-header {
        padding: 12px 15px;
        font-size: 14px;
    }

    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
}

/* ============================================
   Theme Toggle (pages)
   ============================================ */
.theme-toggle-nav {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    color: rgba(255,255,255,0.8);
    width: 29px;
    height: 29px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}
.theme-toggle-nav:hover {
    color: white;
    border-color: rgba(255,255,255,0.5);
}

/* Smooth transitions */
html[data-theme] body,
html[data-theme] .card,
html[data-theme] .card-body,
html[data-theme] .card-header,
html[data-theme] .side-panel,
html[data-theme] .side-panel-header,
html[data-theme] .side-panel-footer,
html[data-theme] .modal-content,
html[data-theme] .auth-toolbar,
html[data-theme] input,
html[data-theme] select,
html[data-theme] textarea,
html[data-theme] .btn,
html[data-theme] .navbar,
html[data-theme] .toast-notification {
    transition: background-color 0.2s ease, color 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
html.no-transition * { transition: none !important; }

[data-theme="light"] {
    color-scheme: light;
}

/* ============================================
   Dark Theme (standalone pages)
   ============================================ */
[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] body {
    background: #16171e;
    color: #dcdfe6;
}

[data-theme="dark"] .navbar {
    background: #1a1b24;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

[data-theme="dark"] .main-content {
    color: #dcdfe6;
}

[data-theme="dark"] .card {
    background: #1e1f28;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    border-color: #363743;
}

[data-theme="dark"] .card-header {
    background: #262732;
    border-bottom-color: #363743;
    color: #dcdfe6;
}

[data-theme="dark"] .stat-card {
    background: #1e1f28;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .stat-card .label {
    color: #8b8fa0;
}

[data-theme="dark"] .login-required h3 {
    color: #dcdfe6;
}

[data-theme="dark"] .login-required p {
    color: #8b8fa0;
}

[data-theme="dark"] .empty-state {
    color: #8b8fa0;
}

[data-theme="dark"] .activity-section h6 {
    color: #dcdfe6;
}

[data-theme="dark"] .activity-item {
    background: #1e1f28;
    border-left-color: #3b82f6;
}

[data-theme="dark"] .activity-item .date {
    color: #5e6272;
}

/* Form controls */
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #1e1f28 !important;
    color: #dcdfe6 !important;
    border-color: #363743 !important;
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 0.2rem rgba(59,130,246,0.25) !important;
}

/* Modals */
[data-theme="dark"] .modal-content {
    background: #1e1f28 !important;
    color: #dcdfe6 !important;
    border-color: #363743 !important;
}
[data-theme="dark"] .modal-header {
    background: #262732 !important;
    border-bottom-color: #363743 !important;
}
[data-theme="dark"] .modal-footer {
    background: #262732 !important;
    border-top-color: #363743 !important;
}
[data-theme="dark"] .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Info cards */
[data-theme="dark"] .info-card {
    background: #262732 !important;
}
[data-theme="dark"] .info-row:not(:last-child) {
    border-bottom-color: #363743;
}
[data-theme="dark"] .info-label {
    color: #8b8fa0;
}

/* Tables */
[data-theme="dark"] .table {
    color: #dcdfe6;
}
[data-theme="dark"] .table td, [data-theme="dark"] .table th {
    border-color: #363743;
}
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) {
    background-color: rgba(255,255,255,0.02);
}

/* Text utilities */
[data-theme="dark"] .text-muted {
    color: #5e6272 !important;
}

/* Bootstrap dropdown in pages */
[data-theme="dark"] .dropdown-menu {
    background: #1e1f28;
    border-color: #363743;
}
[data-theme="dark"] .dropdown-item {
    color: #dcdfe6;
}
[data-theme="dark"] .dropdown-item:hover {
    background: #262732;
}

/* Scrollbars */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #16171e;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #363743;
    border-radius: 4px;
}
[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #5e6272;
}

/* Filters & history cards (override inline styles in activity/admin-history) */
[data-theme="dark"] .filters-card {
    background: #1e1f28 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[data-theme="dark"] .history-card {
    background: #1e1f28 !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
[data-theme="dark"] .page-header h1 {
    color: #dcdfe6;
}
[data-theme="dark"] .table th {
    background: #262732;
    color: #8b8fa0;
}
[data-theme="dark"] .filter-group label {
    color: #8b8fa0;
}
[data-theme="dark"] .changes-summary {
    color: #8b8fa0;
}
[data-theme="dark"] .results-count {
    color: #8b8fa0;
}
[data-theme="dark"] .date-time {
    color: #5e6272;
}
[data-theme="dark"] .building-link,
[data-theme="dark"] .user-link {
    color: #5b9cf6;
}
[data-theme="dark"] .pagination-container {
    border-top-color: #363743;
}
[data-theme="dark"] .pagination .page-link {
    color: #5b9cf6;
    background: transparent;
}
[data-theme="dark"] .pagination .page-item.active .page-link {
    background: #3b82f6;
    color: white;
}
[data-theme="dark"] .pagination .page-item.disabled .page-link {
    color: #7a7e90;
}

/* ============================================
   Reduced Motion — WCAG 2.1 SC 2.3.3
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
