/* =====================================================
   QUEMARESME - Towns Page Stylesheet
   ===================================================== */

/* ----- Page Header ----- */
.towns-header {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 50%, #4c1d95 100%);
}

/* ----- Intro ----- */
.towns-intro {
    font-size: 1.125rem;
    line-height: 1.7;
    color: var(--gray-600);
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

/* ----- Type Headers ----- */
.type-header {
    margin-bottom: var(--space-2xl);
}

.type-header h2 {
    font-size: clamp(1.75rem, 4vw, 2.25rem);
}

.type-subtitle {
    font-weight: 400;
    color: var(--gray-500);
    font-size: 0.75em;
}

.type-mar h2 {
    color: #0891b2;
}

.type-munt h2 {
    color: #92400e;
}

.type-header p {
    color: var(--gray-500);
    margin-top: var(--space-xs);
}

/* ----- Town Grid ----- */
.town-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-lg);
}

/* ----- Town Card ----- */
.town-card-item {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    cursor: pointer;
    transition: all var(--transition-base);
    position: relative;
}

.town-card-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 20px rgba(8, 145, 178, 0.12);
    transform: translateY(-2px);
}

.town-card-item.mar-card:hover {
    border-color: #0891b2;
    box-shadow: 0 4px 20px rgba(8, 145, 178, 0.15);
}

.town-card-item.munt-card:hover {
    border-color: #92400e;
    box-shadow: 0 4px 20px rgba(146, 64, 14, 0.12);
}

.town-card-name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0 0 var(--space-xs) 0;
}

.town-card-pop {
    font-size: 0.8125rem;
    color: var(--gray-500);
    margin: 0 0 var(--space-md) 0;
}

.town-card-desc {
    font-size: 0.875rem;
    color: var(--gray-600);
    line-height: 1.5;
    margin: 0;
}

.town-card-more {
    display: inline-block;
    margin-top: var(--space-md);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
}

.mar-card .town-card-more {
    color: #0891b2;
}

.munt-card .town-card-more {
    color: #92400e;
}

/* ----- Town Type Badge ----- */
.town-type-badge {
    display: inline-block;
    padding: 0.2rem 0.625rem;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-sm);
}

.badge-mar {
    background: #ecfeff;
    color: #0e7490;
}

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

/* ----- Modal ----- */
.town-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
}

.town-modal[hidden] {
    display: none;
}

.town-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.town-modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--radius-lg);
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: var(--space-2xl);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: modalIn 0.25s ease-out;
}

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

.town-modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gray-100);
    border-radius: 50%;
    font-size: 1.25rem;
    color: var(--gray-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.town-modal-close:hover {
    background: var(--gray-200);
    color: var(--dark);
}

/* Modal content styling */
.modal-town-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 var(--space-xs) 0;
}

.modal-town-meta {
    display: flex;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.modal-meta-item {
    font-size: 0.875rem;
    color: var(--gray-500);
}

.modal-meta-item strong {
    color: var(--gray-700);
}

.modal-town-desc {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--gray-600);
    margin-bottom: var(--space-xl);
}

.modal-highlights {
    background: var(--gray-50);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.modal-highlights h4 {
    margin: 0 0 var(--space-md) 0;
    font-size: 0.9375rem;
    color: var(--dark);
}

.modal-highlights ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.modal-highlights li {
    font-size: 0.9375rem;
    color: var(--gray-600);
    padding-left: 1.5rem;
    position: relative;
}

.modal-highlights li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

.modal-beaches-link {
    display: inline-block;
    margin-top: var(--space-xl);
}

/* ----- Modal Tabs ----- */
.modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: var(--space-xl);
}

.modal-tab {
    padding: var(--space-md) var(--space-xl);
    border: none;
    background: none;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--gray-500);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.modal-tab:hover {
    color: var(--dark);
}

.modal-tab.active {
    color: var(--primary);
}

.modal-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
}

.modal-tab-content {
    display: none;
}

.modal-tab-content.active {
    display: block;
}

/* History tab content */
.modal-history {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--gray-600);
}

.modal-history p {
    margin-bottom: var(--space-md);
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .town-grid {
        grid-template-columns: 1fr;
    }

    .town-modal {
        padding: var(--space-md);
    }

    .town-modal-content {
        padding: var(--space-xl);
        max-height: 90vh;
    }

    .modal-town-meta {
        flex-direction: column;
        gap: var(--space-sm);
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .town-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
