/* Dark Mode Toggle Switch Styles - Matching Image Design */
.theme-toggle-wrapper {
    display: flex;
    align-items: center;
    margin-right: 0.5rem;
}

.theme-toggle-switch {
    position: relative;
    width: 60px;
    height: 32px;
    background: var(--bg-hover);
    border-radius: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.theme-toggle-switch.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.theme-toggle-slider {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    background: var(--bg-card);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.theme-toggle-switch.active .theme-toggle-slider {
    transform: translateX(28px);
    background: #1e293b;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

/* Sun Icon (Light Mode) */
.theme-toggle-sun {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.theme-toggle-switch.active .theme-toggle-sun {
    opacity: 0.3;
}

.theme-toggle-sun::before {
    content: '☀️';
    font-size: 16px;
    display: block;
    filter: grayscale(0.5);
}

/* Moon Icon (Dark Mode) */
.theme-toggle-moon {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    opacity: 0.3;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.theme-toggle-switch.active .theme-toggle-moon {
    opacity: 1;
}

.theme-toggle-moon::before {
    content: '🌙';
    font-size: 16px;
    display: block;
    filter: brightness(1.2);
}

/* Moon icon inside slider when active */
.theme-toggle-slider::after {
    content: '🌙';
    font-size: 14px;
    position: absolute;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.theme-toggle-switch.active .theme-toggle-slider::after {
    opacity: 1;
}

/* Hover effect */
.theme-toggle-switch:hover {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 0 0 2px rgba(69, 83, 24, 0.2);
}

.theme-toggle-switch.active:hover {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2), 0 0 0 2px rgba(69, 83, 24, 0.3);
}

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

/* Form inputs dark mode support */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
select,
textarea {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="tel"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="datetime-local"],
[data-theme="dark"] input[type="time"],
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--bg-input) !important;
    color: #f8fafc !important;
    border-color: var(--border-color) !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="datetime-local"]:focus,
input[type="time"]:focus,
select:focus,
textarea:focus {
    background: var(--bg-input) !important;
    color: var(--text-primary) !important;
    border-color: var(--primary-color) !important;
}

[data-theme="dark"] input[type="text"]:focus,
[data-theme="dark"] input[type="email"]:focus,
[data-theme="dark"] input[type="password"]:focus,
[data-theme="dark"] input[type="number"]:focus,
[data-theme="dark"] input[type="tel"]:focus,
[data-theme="dark"] input[type="date"]:focus,
[data-theme="dark"] input[type="datetime-local"]:focus,
[data-theme="dark"] input[type="time"]:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    background: var(--bg-input) !important;
    color: #f8fafc !important;
    border-color: var(--primary-color) !important;
}

/* Placeholder text visibility */
input::placeholder,
textarea::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.7;
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.6;
}

/* Select options visibility */
select {
    color: var(--text-primary) !important;
}

select option {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] select option {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Table dark mode support */
table {
    color: var(--text-primary);
}

table th {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

table td {
    background: var(--bg-card);
    color: var(--text-primary);
}

table tr:hover td {
    background: var(--bg-hover);
}

/* Alert boxes dark mode */
.alert {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--secondary-color);
    color: var(--secondary-color);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--warning-color);
    color: var(--warning-color);
}

/* Badge dark mode */
.badge {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Stats grid dark mode */
.stat-card {
    background: var(--bg-card);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Package size options dark mode */
.package-size-option {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.package-size-option:hover {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

.package-size-option.selected {
    background: var(--bg-hover);
    border-color: var(--primary-color);
}

/* Map container dark mode */
.map-container {
    border: 1px solid var(--border-color);
    transition: border-color 0.3s ease;
}

/* Delivery option cards dark mode */
.delivery-option {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Additional dark mode text visibility fixes */
[data-theme="dark"] .features {
    background: var(--bg-primary);
}

[data-theme="dark"] .target-audience {
    background: var(--bg-secondary);
}

[data-theme="dark"] .pricing-estimator {
    background: var(--bg-primary);
}

[data-theme="dark"] .auth-box {
    background: var(--bg-card);
}

[data-theme="dark"] .footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* Ensure all text elements use proper colors */
[data-theme="dark"] h1,
[data-theme="dark"] h2,
[data-theme="dark"] h3,
[data-theme="dark"] h4,
[data-theme="dark"] h5,
[data-theme="dark"] h6 {
    color: var(--text-primary);
}

[data-theme="dark"] p {
    color: var(--text-primary);
}

[data-theme="dark"] label {
    color: var(--text-primary);
}

[data-theme="dark"] .form-group label {
    color: var(--text-primary);
}

/* Fix any remaining white backgrounds */
[data-theme="dark"] .white-bg,
[data-theme="dark"] [style*="background: white"],
[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background: #ffffff"] {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Include common background-color inline variants */
[data-theme="dark"] [style*="background-color: white"],
[data-theme="dark"] [style*="background-color:white"],
[data-theme="dark"] [style*="background-color: #fff"],
[data-theme="dark"] [style*="background-color:#fff"],
[data-theme="dark"] [style*="background-color: #ffffff"],
[data-theme="dark"] [style*="background-color:#ffffff"] {
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Remove common light gray/blue inline backgrounds in dark mode */
[data-theme="dark"] [style*="background: #f8fafc"],
[data-theme="dark"] [style*="background:#f8fafc"],
[data-theme="dark"] [style*="background: #f9fafb"],
[data-theme="dark"] [style*="background:#f9fafb"],
[data-theme="dark"] [style*="background: #f1f5f9"],
[data-theme="dark"] [style*="background:#f1f5f9"],
[data-theme="dark"] [style*="background: #f0f9ff"],
[data-theme="dark"] [style*="background:#f0f9ff"],
[data-theme="dark"] [style*="background-color: #f8fafc"],
[data-theme="dark"] [style*="background-color:#f8fafc"],
[data-theme="dark"] [style*="background-color: #f9fafb"],
[data-theme="dark"] [style*="background-color:#f9fafb"],
[data-theme="dark"] [style*="background-color: #f1f5f9"],
[data-theme="dark"] [style*="background-color:#f1f5f9"],
[data-theme="dark"] [style*="background-color: #f0f9ff"],
[data-theme="dark"] [style*="background-color:#f0f9ff"] {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Catch rgba/rgb light surfaces often used for info boxes/cards */
[data-theme="dark"] [style*="background: rgb(255, 255, 255)"],
[data-theme="dark"] [style*="background:rgb(255,255,255)"],
[data-theme="dark"] [style*="background-color: rgb(255, 255, 255)"],
[data-theme="dark"] [style*="background-color:rgb(255,255,255)"],
[data-theme="dark"] [style*="background: rgb(249, 250, 251)"],
[data-theme="dark"] [style*="background:rgb(249,250,251)"],
[data-theme="dark"] [style*="background: rgb(241, 245, 249)"],
[data-theme="dark"] [style*="background:rgb(241,245,249)"],
[data-theme="dark"] [style*="background: rgba(255, 255, 255,"],
[data-theme="dark"] [style*="background:rgba(255,255,255,"],
[data-theme="dark"] [style*="background-color: rgba(255, 255, 255,"],
[data-theme="dark"] [style*="background-color:rgba(255,255,255,"] {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

/* Utility-style classes that can keep pages bright in dark mode */
[data-theme="dark"] .bg-white,
[data-theme="dark"] .bg-light,
[data-theme="dark"] .bg-light-gray,
[data-theme="dark"] .bg-gray-50,
[data-theme="dark"] .bg-slate-50 {
    background: var(--bg-card) !important;
    background-color: var(--bg-card) !important;
}

/* Fix any remaining dark text on dark backgrounds */
[data-theme="dark"] [style*="color: #000"],
[data-theme="dark"] [style*="color: black"],
[data-theme="dark"] [style*="color: #0f172a"] {
    color: var(--text-primary) !important;
}

/* Fix muted inline colors that are too low-contrast in dark mode */
[data-theme="dark"] [style*="color: #666"],
[data-theme="dark"] [style*="color:#666"],
[data-theme="dark"] [style*="color: #666666"],
[data-theme="dark"] [style*="color:#666666"],
[data-theme="dark"] [style*="color: #999"],
[data-theme="dark"] [style*="color:#999"],
[data-theme="dark"] [style*="color: #999999"],
[data-theme="dark"] [style*="color:#999999"] {
    color: var(--text-secondary) !important;
}

/* Cover rgb inline color declarations frequently used in templates */
[data-theme="dark"] [style*="color: rgb(102, 102, 102)"],
[data-theme="dark"] [style*="color:rgb(102,102,102)"],
[data-theme="dark"] [style*="color: rgb(153, 153, 153)"],
[data-theme="dark"] [style*="color:rgb(153,153,153)"] {
    color: var(--text-secondary) !important;
}

/* Auth page specific fixes */
[data-theme="dark"] .auth-box {
    background: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .auth-box p {
    color: var(--text-secondary);
}

[data-theme="dark"] .auth-header p {
    color: var(--text-secondary);
}

/* Ensure all form inputs in auth pages are visible */
[data-theme="dark"] .auth-box input,
[data-theme="dark"] .auth-box select,
[data-theme="dark"] .auth-box textarea {
    background: var(--bg-input) !important;
    color: #f8fafc !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .auth-box input[type="text"],
[data-theme="dark"] .auth-box input[type="email"],
[data-theme="dark"] .auth-box input[type="password"],
[data-theme="dark"] .auth-box input[type="tel"],
[data-theme="dark"] .auth-box input[type="number"] {
    color: #f8fafc !important;
}

[data-theme="dark"] .auth-box input::placeholder,
[data-theme="dark"] .auth-box textarea::placeholder {
    color: #cbd5e1 !important;
    opacity: 0.8;
}

[data-theme="dark"] .auth-box select {
    color: #f8fafc !important;
}

[data-theme="dark"] .auth-box select option {
    background: var(--bg-card) !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .auth-box label {
    color: #f8fafc !important;
}

[data-theme="dark"] .auth-footer a {
    color: var(--primary-light) !important;
}

[data-theme="dark"] .auth-footer p {
    color: #cbd5e1 !important;
}

/* Button text visibility - ensure buttons always have white text */
[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-secondary,
[data-theme="dark"] .btn-danger {
    color: #ffffff !important;
}

/* Hero section text visibility */
[data-theme="dark"] .hero {
    color: #ffffff !important;
}

[data-theme="dark"] .hero h1,
[data-theme="dark"] .hero p {
    color: #ffffff !important;
}

/* Price result text visibility */
[data-theme="dark"] .price-result {
    color: #ffffff !important;
}

[data-theme="dark"] .price-result h3 {
    color: #ffffff !important;
}

/* Active nav link text */
[data-theme="dark"] .nav-menu a.active {
    color: #ffffff !important;
}

/* Notification badge text */
[data-theme="dark"] .notification-badge {
    color: #ffffff !important;
}

/* Ensure all links are visible */
[data-theme="dark"] a {
    color: var(--primary-light) !important;
}

[data-theme="dark"] .nav-menu a {
    color: #cbd5e1 !important;
}

[data-theme="dark"] .nav-menu a:hover {
    color: var(--primary-light) !important;
}

[data-theme="dark"] .nav-menu a.active {
    color: #ffffff !important;
}

/* Select dropdown text in dark mode */
[data-theme="dark"] select {
    color: #f8fafc !important;
}

[data-theme="dark"] select option {
    background: var(--bg-card) !important;
    color: #f8fafc !important;
}

/* Ensure stat card values are visible */
[data-theme="dark"] .stat-card .stat-value {
    color: var(--text-primary) !important;
}

/* Card text visibility */
[data-theme="dark"] .card {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .card-title {
    color: var(--text-primary) !important;
}

/* Table text visibility */
[data-theme="dark"] table {
    color: var(--text-primary) !important;
}

[data-theme="dark"] table th {
    color: var(--text-primary) !important;
}

[data-theme="dark"] table td {
    color: var(--text-primary) !important;
}

/* Feature card text */
[data-theme="dark"] .feature-card h3 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .feature-card p {
    color: var(--text-secondary) !important;
}

/* Audience item text */
[data-theme="dark"] .audience-item {
    color: var(--text-primary) !important;
}

/* Auth header text */
[data-theme="dark"] .auth-header h1 {
    color: var(--text-primary) !important;
}

/* Status colors visibility - ensure they're bright enough in dark mode */
[data-theme="dark"] .status-pending {
    color: #fbbf24 !important; /* Brighter yellow */
}

[data-theme="dark"] .status-accepted {
    color: #60a5fa !important; /* Brighter blue */
}

[data-theme="dark"] .status-picked_up {
    color: #a78bfa !important; /* Brighter purple */
}

[data-theme="dark"] .status-in_transit {
    color: #22d3ee !important; /* Brighter cyan */
}

[data-theme="dark"] .status-delivered {
    color: #455318 !important; /* Brighter green */
}

[data-theme="dark"] .status-cancelled {
    color: #f87171 !important; /* Brighter red */
}

/* Ensure all text in cards and containers is visible */
[data-theme="dark"] * {
    color: inherit;
}

/* Fix any remaining contrast issues */
[data-theme="dark"] .dashboard-header h1 {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .features h2,
[data-theme="dark"] .target-audience h2,
[data-theme="dark"] .pricing-estimator h2 {
    color: var(--text-primary) !important;
}

/* Ensure ALL text elements are visible in dark mode */
[data-theme="dark"] {
    color: #f8fafc !important;
}

[data-theme="dark"] span,
[data-theme="dark"] div,
[data-theme="dark"] li,
[data-theme="dark"] td,
[data-theme="dark"] th,
[data-theme="dark"] small,
[data-theme="dark"] strong,
[data-theme="dark"] b,
[data-theme="dark"] em,
[data-theme="dark"] i {
    color: inherit;
}

/* Mobile text wrapping and visibility */
[data-theme="dark"] * {
    word-wrap: break-word;
    word-break: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Ensure all text has minimum contrast in dark mode */
[data-theme="dark"] .text-muted,
[data-theme="dark"] .text-secondary {
    color: #cbd5e1 !important; /* Brighter for better visibility */
}

[data-theme="dark"] .text-primary {
    color: #f8fafc !important; /* Pure white for best visibility */
}

/* Comprehensive text visibility fixes for dark mode */
[data-theme="dark"] p:not(.btn *):not(button *),
[data-theme="dark"] span:not(.btn *):not(button *),
[data-theme="dark"] div:not(.btn):not(button):not([class*="btn"]) {
    color: #f8fafc !important;
}

[data-theme="dark"] .card p,
[data-theme="dark"] .card span,
[data-theme="dark"] .card div {
    color: #f8fafc !important;
}

[data-theme="dark"] .stat-card .stat-label,
[data-theme="dark"] .stat-card .stat-value {
    color: #f8fafc !important;
}

[data-theme="dark"] .badge {
    color: #ffffff !important;
}

/* Ensure list items are visible */
[data-theme="dark"] ul li,
[data-theme="dark"] ol li {
    color: #f8fafc !important;
}

/* Mobile-specific dark mode text fixes */
@media (max-width: 768px) {
    [data-theme="dark"] p,
    [data-theme="dark"] span:not(.btn *):not(button *),
    [data-theme="dark"] div:not(.btn):not(button):not([class*="btn"]),
    [data-theme="dark"] li,
    [data-theme="dark"] td,
    [data-theme="dark"] th {
        color: #f8fafc !important;
    }
    
    [data-theme="dark"] .text-muted,
    [data-theme="dark"] .text-secondary {
        color: #cbd5e1 !important;
    }
    
    /* Ensure buttons still have proper contrast */
    [data-theme="dark"] .btn-primary,
    [data-theme="dark"] .btn-secondary,
    [data-theme="dark"] .btn-danger,
    [data-theme="dark"] button,
    [data-theme="dark"] .btn {
        color: #ffffff !important;
    }
}

/* Google Places Autocomplete Dark Mode */
[data-theme="dark"] .pac-container {
    background: #1e293b !important;
    border: 1px solid #334155 !important;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
}

[data-theme="dark"] .pac-item {
    background: #1e293b !important;
    border-bottom: 1px solid #334155 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .pac-item:hover {
    background: #334155 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .pac-item-selected {
    background: #334155 !important;
    color: #f8fafc !important;
}

[data-theme="dark"] .pac-icon {
    filter: brightness(0) invert(1) !important;
    opacity: 0.7 !important;
}

[data-theme="dark"] .pac-item-query {
    color: #f8fafc !important;
    font-weight: 400 !important;
}

[data-theme="dark"] .pac-matched {
    color: #60a5fa !important;
    font-weight: 600 !important;
}

[data-theme="dark"] .pac-hint {
    color: #cbd5e1 !important;
}

/* Mobile Google Places Autocomplete Dark Mode */
@media (max-width: 768px) {
    [data-theme="dark"] .pac-container {
        background: #1e293b !important;
        border: 1px solid #475569 !important;
        box-shadow: 0 8px 16px rgba(0,0,0,0.5) !important;
    }

    [data-theme="dark"] .pac-item {
        background: #1e293b !important;
        border-bottom: 1px solid #475569 !important;
        color: #f8fafc !important;
        padding: 12px 16px !important;
        font-size: 16px !important;
    }

    [data-theme="dark"] .pac-item:hover,
    [data-theme="dark"] .pac-item-selected {
        background: #475569 !important;
        color: #f8fafc !important;
    }

    [data-theme="dark"] .pac-item-query {
        color: #f8fafc !important;
        font-size: 16px !important;
    }

    [data-theme="dark"] .pac-matched {
        color: #93c5fd !important;
        font-weight: 600 !important;
    }

    [data-theme="dark"] .pac-hint {
        color: #94a3b8 !important;
        font-size: 14px !important;
    }
}

/* Fix hardcoded colors in rider pages */
[data-theme="dark"] .status-online {
    background: #455318 !important;
}

[data-theme="dark"] .status-offline {
    background: #ef4444 !important;
}

/* Fix hardcoded #666 colors */
[data-theme="dark"] [style*="color: #666"],
[data-theme="dark"] [style*="color:#666"] {
    color: #cbd5e1 !important;
}

/* Fix payment pages hardcoded colors */
[data-theme="dark"] .success-header {
    background: #059669 !important;
}

[data-theme="dark"] .failed-header {
    background: #dc2626 !important;
}

[data-theme="dark"] [style*="background: #f3f4f6"] {
    background: var(--bg-card) !important;
}

[data-theme="dark"] [style*="background: #fee2e2"] {
    background: rgba(239, 68, 68, 0.1) !important;
}

[data-theme="dark"] [style*="background: #fef3c7"] {
    background: rgba(245, 158, 11, 0.1) !important;
}

[data-theme="dark"] [style*="background: #d1fae5"] {
    background: rgba(16, 185, 129, 0.1) !important;
}

[data-theme="dark"] [style*="background: #f0f9ff"] {
    background: rgba(59, 130, 246, 0.1) !important;
}

[data-theme="dark"] [style*="background: #f9fafb"] {
    background: var(--bg-card) !important;
}

[data-theme="dark"] [style*="color: #0ea5e9"] {
    color: #60a5fa !important;
}

[data-theme="dark"] [style*="color: #059669"] {
    color: #455318 !important;
}

[data-theme="dark"] [style*="color: #dc2626"] {
    color: #f87171 !important;
}

[data-theme="dark"] [style*="color: #92400e"] {
    color: #fbbf24 !important;
}

[data-theme="dark"] [style*="color: #ef4444"] {
    color: #f87171 !important;
}

