/* ============================================
   Custom styles for mirror.in.th
   Pure PHP + Tailwind CSS companion stylesheet
   ============================================ */

/* ---- Base & Reset ---- */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans Thai', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > main {
    flex: 1;
}

/* ---- Custom Scrollbar ---- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* ---- Global Transitions ---- */
*,
*::before,
*::after {
    transition-property: background-color, color, border-color, box-shadow, opacity;
    transition-duration: 0.3s;
    transition-timing-function: ease;
}

/* Exclude elements where transitions cause issues */
input[type="range"],
input[type="range"]::-webkit-slider-thumb,
.no-transition,
.no-transition * {
    transition: none !important;
}

/* ---- Loading Spinner ---- */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 5px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ---- Gradient Text ---- */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-text-green {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-text-orange {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ---- Hero Gradient ---- */
.hero-gradient {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.hero-gradient::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    animation: heroShimmer 15s ease-in-out infinite;
}

@keyframes heroShimmer {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(30px, -30px);
    }
}

/* ---- Card Hover Effects ---- */
.card-hover {
    transform: translateY(0);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.dark .card-hover:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

/* ---- Calculator Input Styling ---- */
.calc-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: #ffffff;
    color: #1f2937;
    outline: none;
}

.calc-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.calc-input:invalid {
    border-color: #ef4444;
}

.calc-input::placeholder {
    color: #9ca3af;
}

.dark .calc-input {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark .calc-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.dark .calc-input::placeholder {
    color: #6b7280;
}

/* Calculator Result Display */
.calc-result {
    padding: 1.25rem;
    border-radius: 0.75rem;
    background: linear-gradient(135deg, #f0f4ff 0%, #e8ecff 100%);
    border: 1px solid #c7d2fe;
    font-size: 1.5rem;
    font-weight: 700;
    color: #4338ca;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark .calc-result {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border-color: #4338ca;
    color: #a5b4fc;
}

/* Calculator Select */
.calc-select {
    width: 100%;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    background-color: #ffffff;
    color: #1f2937;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    outline: none;
    cursor: pointer;
}

.calc-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.dark .calc-select {
    background-color: #1f2937;
    border-color: #4b5563;
    color: #f9fafb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%239ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3E%3C/svg%3E");
}

/* Calculator Button */
.calc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    min-width: 120px;
}

.calc-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.calc-btn:active {
    transform: translateY(0);
}

.calc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.calc-btn-secondary {
    background: #e5e7eb;
    color: #374151;
}

.calc-btn-secondary:hover {
    background: #d1d5db;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dark .calc-btn-secondary {
    background: #374151;
    color: #e5e7eb;
}

.dark .calc-btn-secondary:hover {
    background: #4b5563;
}

/* ---- Resistor Visualization ---- */
.resistor-body {
    position: relative;
    width: 280px;
    height: 80px;
    background: linear-gradient(180deg, #d4a574 0%, #c49464 50%, #b48454 100%);
    border-radius: 12px;
    margin: 2rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 30px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.resistor-body::before,
.resistor-body::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 6px;
    background: #888;
    top: 50%;
    transform: translateY(-50%);
}

.resistor-body::before {
    left: -40px;
}

.resistor-body::after {
    right: -40px;
}

.resistor-band {
    width: 16px;
    height: 60px;
    border-radius: 2px;
    box-shadow: inset 0 0 3px rgba(0, 0, 0, 0.3);
    position: relative;
}

.resistor-band.tolerance {
    margin-left: 16px;
}

/* Resistor band colors */
.band-black { background-color: #1a1a1a; }
.band-brown { background-color: #8b4513; }
.band-red { background-color: #dc2626; }
.band-orange { background-color: #ea580c; }
.band-yellow { background-color: #eab308; }
.band-green { background-color: #16a34a; }
.band-blue { background-color: #2563eb; }
.band-violet { background-color: #7c3aed; }
.band-grey { background-color: #6b7280; }
.band-white { background-color: #f5f5f5; border: 1px solid #e5e7eb; }
.band-gold { background: linear-gradient(180deg, #ffd700 0%, #daa520 100%); }
.band-silver { background: linear-gradient(180deg, #e8e8e8 0%, #b0b0b0 100%); }
.band-none { background: transparent; border: 2px dashed #9ca3af; }

/* ---- RAID Disk Visualization ---- */
.raid-container {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    justify-content: center;
    padding: 1.5rem;
    background: #1f2937;
    border-radius: 0.75rem;
    min-height: 200px;
}

.raid-disk {
    width: 48px;
    min-height: 120px;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    font-size: 0.6rem;
    color: #ffffff;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.raid-disk-data {
    background: linear-gradient(180deg, #3b82f6, #2563eb);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.3);
}

.raid-disk-parity {
    background: linear-gradient(180deg, #f59e0b, #d97706);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.raid-disk-mirror {
    background: linear-gradient(180deg, #10b981, #059669);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.raid-disk-failed {
    background: linear-gradient(180deg, #ef4444, #dc2626);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
    animation: diskPulse 2s ease-in-out infinite;
}

.raid-disk-spare {
    background: linear-gradient(180deg, #6b7280, #4b5563);
    box-shadow: 0 0 8px rgba(107, 114, 128, 0.3);
}

.raid-disk-label {
    font-weight: 700;
    font-size: 0.7rem;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.raid-stripe {
    padding: 2px;
    font-size: 0.55rem;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.15);
}

@keyframes diskPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ---- Hero Orbs (Animated Gradient Blobs) ---- */
.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    pointer-events: none;
    will-change: transform;
}

.hero-orb-1 {
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(99,102,241,0.6) 0%, transparent 70%);
    top: -200px; left: -100px;
    animation: orbFloat1 20s ease-in-out infinite;
}

.hero-orb-2 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(168,85,247,0.5) 0%, transparent 70%);
    bottom: -150px; right: -100px;
    animation: orbFloat2 25s ease-in-out infinite;
}

.hero-orb-3 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(59,130,246,0.4) 0%, transparent 70%);
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    animation: orbFloat3 18s ease-in-out infinite;
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(80px, 40px) scale(1.1); }
    50% { transform: translate(40px, 80px) scale(0.95); }
    75% { transform: translate(-40px, 30px) scale(1.05); }
}

@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-60px, -40px) scale(1.1); }
    66% { transform: translate(30px, -60px) scale(0.9); }
}

@keyframes orbFloat3 {
    0%, 100% { transform: translate(-50%, -50%) scale(1); }
    50% { transform: translate(-40%, -60%) scale(1.15); }
}

/* ---- Scroll Bounce Indicator ---- */
.scroll-bounce {
    animation: scrollBounce 2s ease-in-out infinite;
}

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.5; }
    50% { transform: translateX(-50%) translateY(10px); opacity: 1; }
}

/* ---- Animations ---- */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease-out forwards;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease-out forwards;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-left {
    animation: slideInLeft 0.5s ease-out forwards;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.5s ease-out forwards;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.animate-scale-in {
    animation: scaleIn 0.3s ease-out forwards;
}

@keyframes pulseSlow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

.animate-pulse-slow {
    animation: pulseSlow 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.animate-shimmer {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.dark .animate-shimmer {
    background: linear-gradient(90deg, #1f2937 25%, #374151 50%, #1f2937 75%);
    background-size: 200% 100%;
}

/* Stagger animation delays for lists */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
.stagger-6 { animation-delay: 0.6s; }
.stagger-7 { animation-delay: 0.7s; }
.stagger-8 { animation-delay: 0.8s; }

/* ---- Counter Animation ---- */
.counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
    font-weight: 700;
}

/* ---- Toast Notifications ---- */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    pointer-events: auto;
    animation: toastIn 0.3s ease-out;
    backdrop-filter: blur(8px);
}

.toast-success {
    background-color: rgba(16, 185, 129, 0.95);
    color: #ffffff;
}

.toast-error {
    background-color: rgba(239, 68, 68, 0.95);
    color: #ffffff;
}

.toast-warning {
    background-color: rgba(245, 158, 11, 0.95);
    color: #ffffff;
}

.toast-info {
    background-color: rgba(59, 130, 246, 0.95);
    color: #ffffff;
}

.toast-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.7;
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    opacity: 1;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

.toast-exit {
    animation: toastOut 0.3s ease-in forwards;
}

/* ---- Scroll To Top Button ---- */
.scroll-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 50;
}

.scroll-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.5);
}

.scroll-to-top svg {
    width: 24px;
    height: 24px;
}

/* ---- Navigation Active State ---- */
.nav-link {
    position: relative;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 500;
    color: #4b5563;
}

.nav-link:hover {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.05);
}

.nav-link.active {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
}

.dark .nav-link {
    color: #d1d5db;
}

.dark .nav-link:hover {
    color: #a5b4fc;
    background-color: rgba(102, 126, 234, 0.1);
}

.dark .nav-link.active {
    color: #a5b4fc;
    background-color: rgba(102, 126, 234, 0.2);
}

/* ---- Table Styles ---- */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    background: #f9fafb;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.dark .data-table thead th {
    background: #1f2937;
    color: #9ca3af;
    border-bottom-color: #374151;
}

.data-table tbody td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.875rem;
    color: #374151;
}

.dark .data-table tbody td {
    border-bottom-color: #1f2937;
    color: #d1d5db;
}

.data-table tbody tr:hover {
    background: #f9fafb;
}

.dark .data-table tbody tr:hover {
    background: rgba(55, 65, 81, 0.5);
}

/* ---- Skeleton Loading ---- */
.skeleton {
    position: relative;
    overflow: hidden;
    background: #e5e7eb;
    border-radius: 0.375rem;
}

.dark .skeleton {
    background: #374151;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    animation: shimmer 1.5s infinite;
}

.dark .skeleton::after {
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.05) 50%, transparent 100%);
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-text-sm {
    height: 0.75rem;
    width: 60%;
}

.skeleton-title {
    height: 1.5rem;
    width: 40%;
    margin-bottom: 1rem;
}

.skeleton-circle {
    border-radius: 50%;
}

/* ---- Badge Styles ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
}

.badge-green {
    background: #d1fae5;
    color: #065f46;
}

.dark .badge-green {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
}

.badge-yellow {
    background: #fef3c7;
    color: #92400e;
}

.dark .badge-yellow {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
}

.badge-red {
    background: #fee2e2;
    color: #991b1b;
}

.dark .badge-red {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.badge-blue {
    background: #dbeafe;
    color: #1e40af;
}

.dark .badge-blue {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.badge-purple {
    background: #ede9fe;
    color: #5b21b6;
}

.dark .badge-purple {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

.badge-gray {
    background: #f3f4f6;
    color: #374151;
}

.dark .badge-gray {
    background: rgba(107, 114, 128, 0.2);
    color: #d1d5db;
}

/* ---- Tooltip ---- */
.tooltip-wrapper {
    position: relative;
    display: inline-block;
}

.tooltip-wrapper .tooltip-text {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: #ffffff;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 50;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.tooltip-wrapper .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #1f2937 transparent transparent transparent;
}

.tooltip-wrapper:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* ---- Tab Component ---- */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #e5e7eb;
    gap: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dark .tab-nav {
    border-bottom-color: #374151;
}

.tab-btn {
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    font-size: 0.875rem;
    color: #6b7280;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    white-space: nowrap;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab-btn:hover {
    color: #667eea;
}

.tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.dark .tab-btn {
    color: #9ca3af;
}

.dark .tab-btn:hover {
    color: #a5b4fc;
}

.dark .tab-btn.active {
    color: #a5b4fc;
    border-bottom-color: #a5b4fc;
}

.tab-content {
    display: none;
    padding: 1.5rem 0;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

/* ---- Map Container ---- */
.map-container {
    width: 100%;
    height: 400px;
    border-radius: 0.75rem;
    overflow: hidden;
    border: 2px solid #e5e7eb;
}

.dark .map-container {
    border-color: #374151;
}

/* ---- Charts Container ---- */
.chart-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: auto !important;
}

/* ---- Air Quality Index Colors ---- */
.aqi-good {
    background: #10b981;
    color: #ffffff;
}

.aqi-moderate {
    background: #f59e0b;
    color: #ffffff;
}

.aqi-unhealthy-sensitive {
    background: #f97316;
    color: #ffffff;
}

.aqi-unhealthy {
    background: #ef4444;
    color: #ffffff;
}

.aqi-very-unhealthy {
    background: #8b5cf6;
    color: #ffffff;
}

.aqi-hazardous {
    background: #991b1b;
    color: #ffffff;
}

/* ---- Earthquake Severity ---- */
.eq-minor {
    color: #10b981;
}

.eq-light {
    color: #f59e0b;
}

.eq-moderate {
    color: #f97316;
}

.eq-strong {
    color: #ef4444;
}

.eq-major {
    color: #dc2626;
    font-weight: 700;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    color: #d1d5db;
}

.dark .breadcrumb {
    color: #9ca3af;
}

.dark .breadcrumb a {
    color: #a5b4fc;
}

.dark .breadcrumb .separator {
    color: #4b5563;
}

/* ---- Form Validation States ---- */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
}

.dark .form-label {
    color: #d1d5db;
}

.form-hint {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

.form-error {
    font-size: 0.75rem;
    color: #ef4444;
    margin-top: 0.25rem;
    display: none;
}

.form-group.has-error .form-error {
    display: block;
}

.form-group.has-error .calc-input {
    border-color: #ef4444;
}

.form-group.has-error .calc-input:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

/* ---- Responsive Helpers ---- */
.container-narrow {
    max-width: 768px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

.container-wide {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Hide on mobile, show on desktop */
.desktop-only {
    display: none;
}

@media (min-width: 768px) {
    .desktop-only {
        display: block;
    }
    .mobile-only {
        display: none;
    }
}

/* Responsive text */
.text-responsive-sm {
    font-size: 0.875rem;
}

@media (min-width: 768px) {
    .text-responsive-sm {
        font-size: 1rem;
    }
}

.text-responsive-lg {
    font-size: 1.5rem;
}

@media (min-width: 768px) {
    .text-responsive-lg {
        font-size: 2.25rem;
    }
}

/* Responsive grid gap */
.gap-responsive {
    gap: 1rem;
}

@media (min-width: 768px) {
    .gap-responsive {
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .gap-responsive {
        gap: 2rem;
    }
}

/* ---- Dark Mode Additional Adjustments ---- */
.dark body {
    background-color: #111827;
    color: #f9fafb;
}

.dark .bg-white {
    background-color: #1f2937;
}

.dark .border-gray-200 {
    border-color: #374151;
}

.dark .text-gray-600 {
    color: #9ca3af;
}

.dark .text-gray-800 {
    color: #f3f4f6;
}

.dark .shadow-md {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.dark .hero-gradient {
    background: linear-gradient(135deg, #4338ca 0%, #5b21b6 100%);
}

/* ---- Focus Styles for Accessibility ---- */
*:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.dark *:focus-visible {
    outline-color: #a5b4fc;
}

/* Skip to content link */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: #667eea;
    color: #ffffff;
    padding: 0.5rem 1rem;
    z-index: 9999;
    border-radius: 0 0 0.375rem 0;
    font-weight: 600;
}

.skip-link:focus {
    top: 0;
}

/* Reduced motion */
@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;
    }
}

/* ---- Print Styles ---- */
@media print {
    nav,
    footer,
    .no-print,
    .scroll-to-top,
    .toast-container {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
        font-size: 12pt;
    }

    a {
        color: black !important;
        text-decoration: underline;
    }

    a[href]::after {
        content: ' (' attr(href) ')';
        font-size: 0.8em;
        color: #666;
    }

    .hero-gradient {
        background: #f3f4f6 !important;
        color: black !important;
    }

    .gradient-text {
        -webkit-text-fill-color: initial;
        background: none;
        color: black;
    }

    .card-hover {
        box-shadow: none !important;
        border: 1px solid #ccc;
    }

    .calc-result {
        background: #f9fafb !important;
        border: 2px solid #333;
        color: #000 !important;
    }
}
