/**
 * Custom Styles
 * Web Comparadora de Estaciones Meteorológicas
 */

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Smooth transitions */
* {
    transition-property: background-color, border-color, color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

.dark ::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.dark ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

.dark ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Prose styles for article content */
.prose h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: inherit;
}

.prose h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: inherit;
}

.prose p {
    margin-bottom: 1rem;
    line-height: 1.75;
}

.prose ul, .prose ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.prose li {
    margin-bottom: 0.5rem;
}

.prose ul li {
    list-style-type: disc;
}

.prose ol li {
    list-style-type: decimal;
}

.prose strong {
    font-weight: 600;
}

.prose a {
    color: #137fec;
    text-decoration: underline;
}

.prose a:hover {
    color: #0d5fb8;
}

/* Station description styles */
.station-description h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #0f172a;
}

.dark .station-description h3 {
    color: #f1f5f9;
}

.station-description p {
    margin-bottom: 1rem;
    line-height: 1.75;
}

.station-description ul {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.station-description li {
    margin-bottom: 0.5rem;
    list-style-type: disc;
}

.station-description strong {
    font-weight: 600;
    color: #0f172a;
}

.dark .station-description strong {
    color: #f1f5f9;
}

/* Card hover effects */
.card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.15);
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Filter chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-chip.active {
    background-color: rgba(19, 127, 236, 0.2);
    color: #137fec;
}

.filter-chip:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dark .filter-chip:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Rating bar animation */
.rating-bar {
    transition: width 0.5s ease;
}

/* Loading spinner */
.spinner {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Skeleton loading */
.skeleton {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Table responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Comparison table specific styles */
.comparison-table th,
.comparison-table td {
    min-width: 200px;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background-color: inherit;
}

/* Modal backdrop */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
}

/* Focus styles */
input:focus, 
select:focus, 
textarea:focus,
button:focus {
    outline: none;
    ring: 2px;
    ring-color: #137fec;
}

/* Print styles */
@media print {
    header, footer, .no-print {
        display: none !important;
    }
    
    main {
        padding: 0 !important;
    }
    
    .container {
        max-width: 100% !important;
    }
}

/* =====================================================
   Station Gallery
   ===================================================== */
.station-gallery {
    position: relative;
}

.gallery-main {
    position: relative;
    overflow: hidden;
}

.gallery-main img {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.gallery-badge {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 8px;
    pointer-events: none;
}

.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 8px;
}

.gallery-thumb {
    aspect-ratio: 4/3;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    opacity: 0.7;
    transition: opacity 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.gallery-thumb:hover {
    opacity: 1;
    transform: scale(1.05);
}

.gallery-thumb--active {
    opacity: 1;
    border-color: #137fec;
}

.gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* =====================================================
   Lightbox
   ===================================================== */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox--open {
    opacity: 1;
    visibility: visible;
}

.lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(12px);
}

.lightbox__content {
    position: relative;
    z-index: 2;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox__image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.lightbox--open .lightbox__image {
    transform: scale(1);
}

.lightbox__caption {
    margin-top: 16px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.875rem;
    text-align: center;
    max-width: 600px;
}

.lightbox__close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 3;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox__close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox__nav {
    position: absolute;
    top: 50%;
    z-index: 3;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox__nav:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-50%) scale(1.1);
}

.lightbox__nav--prev {
    left: 20px;
}

.lightbox__nav--next {
    right: 20px;
}

.lightbox__counter {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    padding: 6px 16px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 20px;
    letter-spacing: 0.05em;
}

@media (max-width: 768px) {
    .lightbox__nav {
        width: 40px;
        height: 40px;
    }
    .lightbox__nav--prev {
        left: 8px;
    }
    .lightbox__nav--next {
        right: 8px;
    }
    .lightbox__close {
        top: 12px;
        right: 12px;
    }
    .gallery-thumbs {
        grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    }
}

/* =====================================================
   FAQ Accordion
   ===================================================== */
.faq-trigger {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.faq-trigger:hover {
    background: rgba(0, 0, 0, 0.02);
}

.dark .faq-trigger:hover {
    background: rgba(255, 255, 255, 0.03);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.faq-item--open .faq-icon {
    transform: rotate(180deg);
}

.faq-item {
    transition: box-shadow 0.2s ease;
}

.faq-item--open {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.dark .faq-item--open {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}
