/* Custom styles for QR Central - Theme Aware */

/* Dark theme styles (default) */
[data-bs-theme="dark"] body {
    background-color: #0d1117;
    color: #e6edf3;
}

/* Light theme styles */
[data-bs-theme="light"] body {
    background-color: #ffffff;
    color: #212529;
}

.card {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.5);
}

.table-dark {
    --bs-table-bg: #161b22;
    --bs-table-border-color: #30363d;
}

.table-dark > :not(caption) > * > * {
    border-bottom-color: #30363d;
}

/* Dark theme form controls */
[data-bs-theme="dark"] .form-control, 
[data-bs-theme="dark"] .form-select {
    background-color: #21262d;
    border-color: #30363d;
    color: #e6edf3;
}

[data-bs-theme="dark"] .form-control:focus, 
[data-bs-theme="dark"] .form-select:focus {
    background-color: #21262d;
    border-color: #58a6ff;
    color: #e6edf3;
    box-shadow: 0 0 0 0.25rem rgba(88, 166, 255, 0.25);
}

/* Light theme form controls use Bootstrap defaults */

.btn-outline-primary:hover,
.btn-outline-success:hover,
.btn-outline-info:hover,
.btn-outline-warning:hover,
.btn-outline-danger:hover {
    color: #000;
}

.navbar-brand {
    font-weight: 600;
}

[data-bs-theme="dark"] .card-header {
    background-color: #21262d;
    border-bottom: 1px solid #30363d;
}

[data-bs-theme="dark"] .modal-content {
    background-color: #0d1117;
    border: 1px solid #30363d;
}

[data-bs-theme="dark"] .modal-header {
    border-bottom: 1px solid #30363d;
}

[data-bs-theme="dark"] .modal-footer {
    border-top: 1px solid #30363d;
}

[data-bs-theme="dark"] .dropdown-menu {
    background-color: #161b22;
    border: 1px solid #30363d;
}

[data-bs-theme="dark"] .dropdown-item {
    color: #e6edf3;
}

[data-bs-theme="dark"] .dropdown-item:hover {
    background-color: #21262d;
    color: #e6edf3;
}

.alert {
    border: none;
}

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

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

/* QR Code specific styles */
.qr-code-container {
    background: white;
    padding: 20px;
    border-radius: 8px;
    display: inline-block;
}

.analytics-card {
    transition: transform 0.2s;
}

.analytics-card:hover {
    transform: translateY(-2px);
}

/* Status badges */
.badge {
    font-size: 0.75em;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .btn-group-sm .btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Chart containers */
canvas {
    max-height: 400px;
}

/* Table improvements */
.table-responsive {
    border-radius: 0.375rem;
}

.table > :not(caption) > * > * {
    padding: 0.75rem 0.5rem;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Custom scrollbar for dark theme */
[data-bs-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-track {
    background: #21262d;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #30363d;
    border-radius: 4px;
}

[data-bs-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #484f58;
}

/* Light theme scrollbar uses browser defaults */

/* Theme toggle button styling */
#themeToggle {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#themeToggle:hover {
    transform: scale(1.1);
}

/* Ensure smooth transitions for theme changes */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Light theme enhancements */
[data-bs-theme="light"] .card {
    background-color: rgba(248, 249, 250, 0.8) !important;
    border: 1px solid rgba(0, 0, 0, 0.125);
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    color: #212529 !important;
}

[data-bs-theme="light"] .card-body {
    background-color: transparent;
    color: #212529 !important;
}

[data-bs-theme="light"] .card-header {
    background-color: rgba(233, 236, 239, 0.7) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
    color: #212529 !important;
}

[data-bs-theme="light"] .bg-dark {
    background-color: rgba(248, 249, 250, 0.8) !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .bg-secondary {
    background-color: rgba(233, 236, 239, 0.6) !important;
    color: #212529 !important;
}

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

[data-bs-theme="light"] .text-white {
    color: #212529 !important;
}

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

[data-bs-theme="light"] .border-secondary {
    border-color: rgba(0, 0, 0, 0.175) !important;
}

[data-bs-theme="light"] .navbar-dark {
    background-color: var(--bs-primary) !important;
}

/* Make sure QR codes are always readable */
.qr-code-container {
    background: white !important;
    padding: 20px;
    border-radius: 8px;
    display: inline-block;
}

/* Light theme table and form improvements */
[data-bs-theme="light"] .table {
    color: #212529 !important;
}

[data-bs-theme="light"] .table-dark {
    background-color: rgba(248, 249, 250, 0.8) !important;
    color: #212529 !important;
    border-color: rgba(0, 0, 0, 0.125) !important;
}

[data-bs-theme="light"] .table-dark > :not(caption) > * > * {
    border-bottom-color: rgba(0, 0, 0, 0.125) !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .form-control,
[data-bs-theme="light"] .form-select {
    background-color: rgba(255, 255, 255, 0.9) !important;
    border-color: #ced4da !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .form-control:focus,
[data-bs-theme="light"] .form-select:focus {
    background-color: #ffffff !important;
    border-color: #86b7fe !important;
    color: #212529 !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

[data-bs-theme="light"] .btn-outline-secondary {
    color: #6c757d !important;
    border-color: #6c757d !important;
}

[data-bs-theme="light"] .dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.15) !important;
}

[data-bs-theme="light"] .dropdown-item {
    color: #212529 !important;
}

[data-bs-theme="light"] .dropdown-item:hover {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

/* Light theme modal improvements */
[data-bs-theme="light"] .modal-content {
    background-color: #ffffff !important;
    border: 1px solid rgba(0, 0, 0, 0.125) !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .modal-header {
    background-color: rgba(248, 249, 250, 0.8) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.125) !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .modal-footer {
    background-color: rgba(248, 249, 250, 0.8) !important;
    border-top: 1px solid rgba(0, 0, 0, 0.125) !important;
    color: #212529 !important;
}

[data-bs-theme="light"] .modal-body {
    color: #212529 !important;
}

/* Light theme alert improvements */
[data-bs-theme="light"] .alert {
    color: #212529 !important;
}

/* Light theme badge improvements */
[data-bs-theme="light"] .badge {
    /* Let Bootstrap handle badge text colors automatically based on background */
}

/* Light theme breadcrumb */
[data-bs-theme="light"] .breadcrumb-item + .breadcrumb-item::before {
    color: #6c757d !important;
}

/* Light theme small text */
[data-bs-theme="light"] small,
[data-bs-theme="light"] .small {
    color: #6c757d !important;
}

/* Fix any remaining dark backgrounds in light mode */
[data-bs-theme="light"] .bg-opacity-25 {
    background-color: rgba(248, 249, 250, 0.25) !important;
}

[data-bs-theme="light"] .border-primary {
    border-color: #0d6efd !important;
}

[data-bs-theme="light"] .border-success {
    border-color: #198754 !important;
}

[data-bs-theme="light"] .border-info {
    border-color: #0dcaf0 !important;
}

[data-bs-theme="light"] .border-warning {
    border-color: #ffc107 !important;
}
