/* Light Mode Theme - Complementary to Dark Theme */
/* This stylesheet is loaded when user selects light mode */

/* Smooth transitions for theme switching */
body,
body * {
    transition: background-color 0.3s ease,
                color 0.3s ease,
                border-color 0.3s ease,
                box-shadow 0.3s ease;
}

/* Override transitions for specific elements that should be instant */
button,
.btn,
a,
input,
select,
textarea {
    transition: all 0.2s ease !important;
}

body.light-mode {
    background: #f8fafc;
    color: #0f172a;
}

/* Navbar */
body.light-mode .navbar {
    background: linear-gradient(145deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.light-mode .navbar .brand {
    color: #0f172a;
}

body.light-mode .navbar .nav-links a {
    color: #475569;
}

body.light-mode .navbar .nav-links a:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #0f172a;
}

body.light-mode .navbar .user-info {
    color: #475569;
}

/* Cards */
body.light-mode .card {
    background: linear-gradient(145deg, #ffffff 0%, #fefefe 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

body.light-mode .card:hover {
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

/* Buttons */
body.light-mode .btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff !important;
    border: 1px solid rgba(59, 130, 246, 0.3);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

body.light-mode .btn:hover {
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    color: #ffffff !important;
}

body.light-mode .btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
    color: #ffffff !important;
}

body.light-mode .btn-danger:hover {
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
    color: #ffffff !important;
}

/* Cancel buttons and transparent background buttons */
body.light-mode .btn[style*="background: rgba(255, 255, 255, 0.1)"],
body.light-mode a.btn[style*="background: rgba(255, 255, 255, 0.1)"] {
    background: rgba(0, 0, 0, 0.08) !important;
    color: #0f172a !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
}

body.light-mode .btn[style*="background: rgba(255, 255, 255, 0.1)"]:hover,
body.light-mode a.btn[style*="background: rgba(255, 255, 255, 0.1)"]:hover {
    background: rgba(0, 0, 0, 0.12) !important;
    color: #0f172a !important;
}

/* Forms */
body.light-mode input,
body.light-mode textarea,
body.light-mode select {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: #0f172a;
}

body.light-mode input:focus,
body.light-mode textarea:focus,
body.light-mode select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

body.light-mode input::placeholder,
body.light-mode textarea::placeholder {
    color: #64748b;
}

body.light-mode label {
    color: #0f172a;
}

/* Messages */
body.light-mode .messages .success {
    background: rgba(34, 197, 94, 0.1);
    color: #15803d;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

body.light-mode .messages .error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Stats cards */
body.light-mode .stats-content h3 {
    color: #334155;
}

body.light-mode .stats-content .stats-number {
    color: #0f172a;
}

body.light-mode .management-card h3 {
    color: #0f172a;
}

body.light-mode .management-card p {
    color: #1e293b;
}

/* Scrollbar */
body.light-mode ::-webkit-scrollbar-track {
    background: #f8fafc;
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

body.light-mode ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Profile specific styles */
body.light-mode h1,
body.light-mode h2,
body.light-mode h3,
body.light-mode h4,
body.light-mode h5 {
    color: #0f172a !important;
}

body.light-mode p {
    color: #1e293b;
}

/* Account information box */
body.light-mode div[style*="background: rgba(59, 130, 246, 0.1)"] {
    background: rgba(59, 130, 246, 0.08) !important;
    border-left-color: #3b82f6;
}

body.light-mode div[style*="background: rgba(59, 130, 246, 0.1)"] h4 {
    color: #1e40af !important;
}

body.light-mode div[style*="background: rgba(59, 130, 246, 0.1)"] span {
    color: #0f172a !important;
}

body.light-mode div[style*="background: rgba(59, 130, 246, 0.1)"] p {
    color: #1e293b !important;
}

/* Theme toggle button */
.theme-toggle-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.theme-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
}

.theme-toggle-btn svg {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.theme-toggle-btn:hover svg {
    transform: rotate(20deg);
}

body.light-mode .theme-toggle-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.2);
}

body.light-mode .theme-toggle-btn:hover {
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
}

/* Tables */
body.light-mode table {
    color: #0f172a;
}

body.light-mode th {
    color: #0f172a !important;
    background: rgba(0, 0, 0, 0.02);
}

body.light-mode td {
    color: #0f172a !important;
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Table cell text and spans */
body.light-mode td *:not(.btn):not(button):not(a.btn),
body.light-mode th *:not(.btn):not(button):not(a.btn) {
    color: #0f172a !important;
}

/* Override any inline styles in table cells */
body.light-mode td[style*="color"]:not(.btn),
body.light-mode td span[style*="color"]:not(.btn) {
    color: #0f172a !important;
}

/* Ensure buttons in tables have white text */
body.light-mode td .btn,
body.light-mode td button,
body.light-mode td a.btn {
    color: #ffffff !important;
}

/* Status badges */
body.light-mode .badge {
    background: rgba(0, 0, 0, 0.08);
    color: #1e293b;
}

/* Links */
body.light-mode a {
    color: #3b82f6;
}

body.light-mode a:hover {
    color: #2563eb;
}

/* Loading state */
body.light-mode .loading {
    border-color: rgba(0, 0, 0, 0.1);
    border-top-color: #3b82f6;
}

/* Provider action buttons */
body.light-mode .provider-action-btn.edit-btn {
    background: #3b82f6;
}

body.light-mode .provider-action-btn.disable-btn {
    background: #f59e0b;
}

body.light-mode .provider-action-btn.enable-btn {
    background: #22c55e;
}

body.light-mode .provider-action-btn.delete-btn {
    background: #ef4444;
}

/* Dashboard specific light mode styles */
body.light-mode .stats-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Adjust any inline styles that might conflict - AGGRESSIVE OVERRIDES */
body.light-mode [style*="color: #ffffff"]:not(.btn):not(button) {
    color: #0f172a !important;
}

body.light-mode [style*="color: #a1a1aa"] {
    color: #0f172a !important;
}

body.light-mode [style*="color: #71717a"] {
    color: #1e293b !important;
}

body.light-mode [style*="color: #64748b"] {
    color: #1e293b !important;
}

body.light-mode [style*="background: rgba(255, 255, 255, 0.05)"] {
    background: #ffffff !important;
}

body.light-mode [style*="border: 1px solid rgba(255, 255, 255, 0.2)"] {
    border: 1px solid #cbd5e1 !important;
}

body.light-mode [style*="border: 1px solid rgba(255, 255, 255, 0.1)"] {
    border: 1px solid #cbd5e1 !important;
}

/* Ensure readability of all text elements */
body.light-mode * {
    scrollbar-color: #cbd5e1 #f8fafc;
}

/* GLOBAL TEXT COLOR DEFAULTS - Apply to all views */
body.light-mode {
    color: #0f172a;
}

/* Additional text readability improvements */
body.light-mode span:not(.btn):not(button),
body.light-mode div:not(.btn):not(button),
body.light-mode td:not(.btn):not(button),
body.light-mode th:not(.btn):not(button),
body.light-mode li:not(.btn):not(button) {
    color: #0f172a;
}

/* Ensure all body text is dark enough */
body.light-mode .card p,
body.light-mode .container p,
body.light-mode div p,
body.light-mode p {
    color: #0f172a !important;
}

/* Management card descriptions - make very dark */
body.light-mode .management-card p {
    color: #0f172a !important;
}

/* All links should be readable */
body.light-mode a:not(.btn) {
    color: #2563eb;
}

body.light-mode a:not(.btn):hover {
    color: #1d4ed8;
}

/* Secondary/muted text should still be readable */
body.light-mode small,
body.light-mode .text-muted {
    color: #334155;
}

/* All text inside cards should be very dark */
body.light-mode .card * {
    color: inherit;
}

body.light-mode .card h1,
body.light-mode .card h2,
body.light-mode .card h3,
body.light-mode .card h4,
body.light-mode .card h5,
body.light-mode .card h6 {
    color: #0f172a !important;
}

/* Buttons inside cards need white text */
body.light-mode .card .btn,
body.light-mode .card button {
    color: #ffffff !important;
}

/* FIX DARK BLUE-GREY BOXES - Database Configuration and Dashboard */
body.light-mode div[style*="background: rgba(15, 23, 42, 0.8)"],
body.light-mode div[style*="background: rgba(30, 41, 59, 0.5)"] {
    background: #f1f5f9 !important;
    border: 1px solid #cbd5e1 !important;
}

/* Ensure text inside these boxes is dark */
body.light-mode div[style*="background: rgba(15, 23, 42, 0.8)"] *:not(.btn):not(button),
body.light-mode div[style*="background: rgba(30, 41, 59, 0.5)"] *:not(.btn):not(button) {
    color: #0f172a !important;
}

/* Fix monospace text inside these boxes */
body.light-mode span[style*="background: rgba(30, 41, 59, 0.5)"] {
    background: #e2e8f0 !important;
    color: #0f172a !important;
}

/* Fix input backgrounds in database config */
body.light-mode input[style*="background: rgba(30, 41, 59, 0.8)"] {
    background: #ffffff !important;
    border: 1px solid #cbd5e1 !important;
    color: #0f172a !important;
}

/* Admin header styles for light mode */
body.light-mode .admin-header h1 {
    color: #0f172a !important;
}

body.light-mode .admin-header p {
    color: #475569 !important;
}

/* Back button and similar transparent background links */
body.light-mode a[style*="background: rgba(148, 163, 184, 0.1)"] {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #0f172a !important;
}

body.light-mode a[style*="background: rgba(148, 163, 184, 0.1)"]:hover {
    background: rgba(0, 0, 0, 0.1) !important;
}

/* Info boxes with blue background */
body.light-mode div[style*="background: rgba(59, 130, 246, 0.1)"] p,
body.light-mode div[style*="background: rgba(59, 130, 246, 0.1)"] strong {
    color: #1e40af !important;
}

/* Fix transparent buttons like Copy button */
body.light-mode button[style*="background: rgba(59, 130, 246, 0.2)"] {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #1d4ed8 !important;
    border-color: rgba(59, 130, 246, 0.4) !important;
}

body.light-mode button[style*="background: rgba(59, 130, 246, 0.2)"]:hover {
    background: rgba(59, 130, 246, 0.25) !important;
    color: #1d4ed8 !important;
}

/* Fix success state for copy button */
body.light-mode button[style*="background: rgba(16, 185, 129, 0.2)"] {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #047857 !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
}

/* COMPREHENSIVE GLOBAL TEXT FIXES - Ensure consistency across all views */

/* All regular text elements should be dark */
body.light-mode label,
body.light-mode legend,
body.light-mode figcaption,
body.light-mode caption {
    color: #0f172a !important;
}

/* Lists */
body.light-mode ul,
body.light-mode ol,
body.light-mode dl {
    color: #0f172a;
}

/* Form labels and help text */
body.light-mode .form-group label,
body.light-mode .form-label,
body.light-mode .form-text,
body.light-mode .help-text {
    color: #0f172a !important;
}

/* Ensure all divs with inline color styles get dark text (except buttons) */
body.light-mode div[style*="color: #ffffff"]:not(.btn):not(button),
body.light-mode div[style*="color: #e4e4e7"]:not(.btn):not(button),
body.light-mode div[style*="color: #a1a1aa"]:not(.btn):not(button),
body.light-mode div[style*="color: #71717a"]:not(.btn):not(button),
body.light-mode div[style*="color: #64748b"]:not(.btn):not(button) {
    color: #0f172a !important;
}

/* Spans with inline color styles */
body.light-mode span[style*="color: #ffffff"]:not(.btn):not(button),
body.light-mode span[style*="color: #e4e4e7"]:not(.btn):not(button),
body.light-mode span[style*="color: #a1a1aa"]:not(.btn):not(button),
body.light-mode span[style*="color: #71717a"]:not(.btn):not(button),
body.light-mode span[style*="color: #64748b"]:not(.btn):not(button),
body.light-mode span[style*="color: #e2e8f0"]:not(.btn):not(button) {
    color: #0f172a !important;
}

/* All container elements */
body.light-mode .container,
body.light-mode .container-fluid,
body.light-mode main,
body.light-mode section,
body.light-mode article {
    color: #0f172a;
}

/* Ensure colored button gradient buttons keep white text */
body.light-mode button[style*="background: linear-gradient"],
body.light-mode a.btn[style*="background: linear-gradient"],
body.light-mode .btn[style*="background: linear-gradient"] {
    color: #ffffff !important;
}

/* Green success buttons */
body.light-mode button[style*="#22c55e"],
body.light-mode a.btn[style*="#22c55e"],
body.light-mode .btn[style*="#22c55e"] {
    color: #ffffff !important;
}

/* Orange/Amber buttons */
body.light-mode button[style*="#f59e0b"],
body.light-mode a.btn[style*="#f59e0b"],
body.light-mode .btn[style*="#f59e0b"] {
    color: #ffffff !important;
}

/* Red danger buttons */
body.light-mode button[style*="#ef4444"],
body.light-mode a.btn[style*="#ef4444"],
body.light-mode .btn[style*="#ef4444"] {
    color: #ffffff !important;
}

/* Responsive theme toggle button */
@media (max-width: 768px) {
    .theme-toggle-btn {
        padding: 8px 16px;
        font-size: 12px;
    }

    .theme-toggle-btn svg {
        width: 14px;
        height: 14px;
    }

    /* Stack theme preference section on mobile */
    body.light-mode div[style*="justify-content: space-between"] {
        flex-direction: column !important;
        gap: 16px;
    }

    body.light-mode .theme-toggle-btn {
        width: 100%;
        justify-content: center;
    }
}
