:root {
    --bg-color: #f5f5f7;
    --text-color: #1d1d1f;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.6);
    --btn-primary: #0071e3;
    --btn-hover: #005bb5;
    --box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    --line-color: rgba(0, 0, 0, 0.14);   /* a border that stays visible on light panels (--glass-border is nearly white) */
}

body.dark-mode {
    --bg-color: #000000;
    --text-color: #f5f5f7;
    --glass-bg: rgba(28, 28, 30, 0.75);
    --glass-border: rgba(80, 80, 80, 0.5);
    --btn-primary: #2997ff;
    --btn-hover: #147ce6;
    --box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    --line-color: rgba(255, 255, 255, 0.22);
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.glass-nav, .glass-panel, .glass-footer {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
}

.glass-nav {
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--glass-border);
    border-radius: 0;
}

.glass-panel {
    border-radius: 24px;
    box-shadow: var(--box-shadow);
}

.glass-footer {
    border-top: 1px solid var(--glass-border);
    border-radius: 0;
}

.apple-btn {
    background-color: var(--btn-primary);
    color: #fff;
    border: none;
    border-radius: 980px;
    padding: 12px 28px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
}
.apple-btn:hover {
    background-color: var(--btn-hover);
    transform: scale(1.02);
    color: #fff;
}

.apple-btn-outline {
    background-color: transparent;
    color: var(--btn-primary);
    border: 1.5px solid var(--btn-primary);
    border-radius: 980px;
    padding: 10px 24px;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}
.apple-btn-outline:hover {
    background-color: var(--btn-primary);
    color: #fff;
}

.btn-icon {
    background: transparent;
    color: var(--text-color);
    border: none;
    font-size: 1.2rem;
}

.apple-info-box {
    background: linear-gradient(135deg, rgba(0, 113, 227, 0.05), rgba(41, 151, 255, 0.1));
    border: 1px solid rgba(0, 113, 227, 0.2);
    border-radius: 16px;
    color: var(--text-color);
}

.drop-zone {
    border: 2px dashed rgba(0, 113, 227, 0.35);
    cursor: pointer;
    transition: all 0.3s ease;
}
.drop-zone:hover {
    border-color: var(--btn-primary);
    background: rgba(0, 113, 227, 0.03);
}

.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    line-height: 2.2;
}
.footer-links a:hover {
    opacity: 1;
    color: var(--btn-primary);
}

body.dark-mode .text-muted {
    color: #a1a1a6 !important;
}

body.dark-mode .text-secondary {
    color: #98989d !important;
}

body.dark-mode .text-dark {
    color: #f5f5f7 !important;
}

body.dark-mode .apple-info-box strong {
    color: #ffffff;
}

body.dark-mode .glass-panel h2,
body.dark-mode .glass-panel h3,
body.dark-mode .glass-panel h4,
body.dark-mode .glass-panel h5,
body.dark-mode .glass-panel h6 {
    color: #ffffff;
}

body.dark-mode .navbar-brand {
    color: #ffffff !important;
}

body.dark-mode .navbar-brand img {
    filter: brightness(0) invert(1);
    transition: filter 0.3s ease;
}

.apple-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(0, 113, 227, 0.2);
    border-radius: 5px;
    outline: none;
    transition: background 0.2s;
}

.apple-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.1s;
}

.apple-slider::-webkit-slider-thumb:active {
    transform: scale(1.15);
}

body.dark-mode .apple-slider {
    background: rgba(255, 255, 255, 0.15);
}
body.dark-mode .apple-slider::-webkit-slider-thumb {
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* Firefox draws the slider with its own pseudo-elements */
.apple-slider::-moz-range-track {
    height: 6px;
    background: transparent;
    border-radius: 5px;
}
.apple-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
}
body.dark-mode .apple-slider::-moz-range-thumb {
    border: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}

/* Keyboard focus: show which slider is selected (mouse and touch use are unchanged) */
.apple-slider:focus-visible {
    outline: 2px solid var(--btn-primary);
    outline-offset: 6px;
}
.apple-slider:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.35), 0 2px 6px rgba(0,0,0,0.2);
}
.apple-slider:focus-visible::-moz-range-thumb {
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.35), 0 2px 6px rgba(0,0,0,0.2);
}

.secondary-nav {
    background: var(--glass-bg);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border);
}

.tools-nav-list {
    padding: 0 !important; 
    margin: 0 !important;
}

.custom-nav-link {
    display: flex !important; 
    align-items: center !important;
    gap: 6px; 
    white-space: nowrap !important; 
    border-radius: 8px;
    transition: all 0.2s ease;
    font-size: 0.9rem; 
    margin: 0; 
    padding: 8px 4px;
}

.tools-nav-list .nav-item:first-child {
    padding-left: 0 !important;
}
.tools-nav-list .nav-item:last-child {
    padding-right: 0 !important;
}

.custom-nav-link:hover {
    background-color: rgba(0, 113, 227, 0.1);
    color: var(--btn-primary) !important;
}

body.dark-mode .custom-nav-link {
    color: #f5f5f7 !important;
}

body.dark-mode .custom-nav-link:hover {
    background-color: rgba(41, 151, 255, 0.2);
    color: #ffffff !important;
}

body.dark-mode .custom-nav-link i.text-muted {
    color: #a1a1a6 !important;
}

.glass-nav.border-bottom-0 {
    border-bottom: none !important;
}

body.dark-mode .secondary-nav {
    border-top: none !important;
    border-bottom: none !important;
}

@media (max-width: 768px) {
    .tools-nav-list {
        justify-content: space-between !important;
        width: 100% !important;
    }
    
    .custom-nav-link {
        padding: 4px 0 !important; 
    }

    .custom-nav-link a {
        font-size: 13px !important; 
        padding: 0 !important;
        margin: 0 !important;
    }

    .custom-nav-link i {
        font-size: 14px !important; 
    }
}

body.dark-mode .alert-info {
    background-color: rgba(13, 202, 240, 0.1) !important;
    border: 1px solid rgba(13, 202, 240, 0.2) !important;
}

body.dark-mode .alert-info h3.text-dark,
body.dark-mode .alert-info .text-dark {
    color: #ffffff !important;
}

body.dark-mode .alert-info p.text-muted {
    color: #ced4da !important;
}

body.dark-mode .alert-info {
    --bs-alert-color: var(--text-color);
    --bs-alert-link-color: #6edff6;
    color: var(--text-color);
}

body.dark-mode .alert-info strong {
    color: #ffffff;
}

.custom-theme-table {
    border-color: var(--glass-border, rgba(255, 255, 255, 0.15)) !important;
    color: var(--text-color, #e0e0e0) !important;
    background: transparent !important;
}

.custom-theme-table thead th {
    background-color: var(--glass-bg, rgba(255, 255, 255, 0.05)) !important;
    color: var(--text-color, #ffffff) !important;
    border-bottom: 2px solid var(--glass-border, rgba(255, 255, 255, 0.2)) !important;
    font-weight: 700;
}

.custom-theme-table td, 
.custom-theme-table th {
    background-color: transparent !important;
    color: inherit !important;
    border-color: var(--glass-border, rgba(255, 255, 255, 0.1)) !important;
}

body.light-mode .custom-theme-table {
    color: #495057 !important;
}

body.light-mode .custom-theme-table thead th {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

.ad-placeholder-wrapper {
    min-width: 250px;
    min-height: 100px;
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.ad-placeholder-wrapper ins.adsbygoogle[data-ad-status="filled"] {
    min-height: auto;
}

[data-bs-theme="dark"] .ad-placeholder-wrapper,
body.dark-mode .ad-placeholder-wrapper {
    background-color: #212529;
    border-color: #495057;
}

.lang-toggle-btn {
    background: transparent;
    border: 1px solid rgba(128, 128, 128, 0.2) !important;
    color: var(--bs-body-color);
    padding: 6px 14px;
    border-radius: 20px !important;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.lang-toggle-btn:hover, 
.lang-toggle-btn:focus,
.lang-toggle-btn[aria-expanded="true"] {
    border-color: #ffc107 !important;
    color: #ffc107 !important;
}

.dropdown-menu {
    border-radius: 1rem !important;
    border: 1px solid rgba(128, 128, 128, 0.2) !important;
    background-color: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    padding: 0 !important;
    margin-top: 10px !important;
    overflow: hidden !important;
}

.dropdown-item,
.dropdown-item.active,
.dropdown-item:active {
    font-weight: 600;
    padding: 10px 20px !important;
    color: #333 !important;
    transition: all 0.2s ease;
    background-color: transparent !important;
}

.dropdown-item:hover,
.dropdown-item:focus,
.dropdown-item.active:hover,
.dropdown-item.active:focus {
    background-color: #ffc107 !important;
    color: #000 !important;
}

.dark-mode .dropdown-menu {
    background-color: rgba(20, 20, 20, 0.95) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5) !important;
}

.dark-mode .dropdown-item,
.dark-mode .dropdown-item.active,
.dark-mode .dropdown-item:active {
    color: #e0e0e0 !important;
    background-color: transparent !important;
}

.dark-mode .dropdown-item:hover,
.dark-mode .dropdown-item:focus,
.dark-mode .dropdown-item.active:hover,
.dark-mode .dropdown-item.active:focus {
    background-color: #ffc107 !important;
    color: #000 !important; 
}

.dark-mode .lang-toggle-btn {
    color: #e0e0e0;
}

body.dark-mode .breadcrumb {
    --bs-breadcrumb-divider-color: rgba(255, 255, 255, 0.6);
}

body.dark-mode .alert-warning {
    --bs-alert-color: #f5e3a3;
    --bs-alert-bg: rgba(255, 193, 7, 0.12);
    --bs-alert-border-color: rgba(255, 193, 7, 0.35);
    --bs-alert-link-color: #ffd65c;
    color: var(--bs-alert-color);
    background-color: var(--bs-alert-bg);
}

body.dark-mode .alert-warning strong,
body.dark-mode .alert-warning a {
    color: #ffd65c;
}

body.light-mode #about-the-author {
    border-color: rgba(0, 0, 0, 0.12) !important;
}

/* Visitors who ask their system for less motion get no transitions or animations */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
