/* Town Hall Bases Selection Page Styles */

body.page-tool--bases {
    background: radial-gradient(ellipse at 50% 0%, rgba(45, 212, 191, 0.07) 0%, transparent 65%),
        radial-gradient(circle at 10% 30%, rgba(139, 92, 246, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.03) 0%, transparent 45%),
        #040a12;
    position: relative;
    overflow-x: hidden;
}

/* Floating Balloons Background Decorative Elements */
.bases-decorations {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bases-decorations__balloon {
    position: absolute;
    width: 80px;
    height: 100px;
    background: radial-gradient(circle at 35% 35%, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
    opacity: 0.18;
    filter: blur(1px);
    animation: float-balloon 22s ease-in-out infinite;
}

.bases-decorations__balloon::after {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 12px solid rgba(255, 255, 255, 0.08);
}

.bases-decorations__balloon--1 {
    top: 15%;
    left: 8%;
    transform: scale(0.8);
    animation-delay: 0s;
    animation-duration: 26s;
}

.bases-decorations__balloon--2 {
    top: 55%;
    right: 5%;
    transform: scale(1.1);
    animation-delay: -5s;
    animation-duration: 32s;
}

.bases-decorations__balloon--3 {
    top: 75%;
    left: 12%;
    transform: scale(0.6);
    animation-delay: -12s;
    animation-duration: 20s;
}

@keyframes float-balloon {
    0%, 100% {
        transform: translateY(0) rotate(2deg) translateX(0);
    }
    50% {
        transform: translateY(-25px) rotate(-3deg) translateX(10px);
    }
}

/* Page Subheading */
.bases-section-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: var(--space-8) 0 var(--space-4) 0;
    text-align: center;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}

.bases-section-title::before,
.bases-section-title::after {
    content: '';
    height: 1px;
    width: 60px;
    background: linear-gradient(90deg, transparent, rgba(45, 212, 191, 0.4));
}

.bases-section-title::after {
    background: linear-gradient(90deg, rgba(45, 212, 191, 0.4), transparent);
}

/* Town Hall Selector Dashboard Grid */
.th-selector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
    gap: var(--space-5);
    margin-bottom: var(--space-8);
    position: relative;
    z-index: 1;
}

/* Glassmorphic Town Hall Card */
.th-card {
    background: rgba(15, 30, 48, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    transition: all 420ms var(--ease-out);
    user-select: none;
    min-height: 160px;
}

.th-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, transparent 100%);
    pointer-events: none;
}

.th-card__image-container {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 450ms cubic-bezier(0.34, 1.6, 0.64, 1);
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
}

.th-card__image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.th-card__title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 800;
    color: #e2fbf4;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    margin: 0;
    letter-spacing: 0.5px;
    transition: color 300ms var(--ease-out), transform 300ms var(--ease-out);
}

/* Card Hover States & Unique themed Glows */
.th-card:hover {
    transform: translateY(-6px);
    background: rgba(18, 38, 62, 0.55);
}

.th-card:hover .th-card__image-container {
    transform: scale(1.18) translateY(-4px);
}

/* TH 13 - Ice Blue Theme */
.th-card--13:hover, .th-card--13.is-active {
    border-color: rgba(56, 189, 248, 0.45);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(56, 189, 248, 0.22);
}
.th-card--13:hover .th-card__title, .th-card--13.is-active .th-card__title {
    color: #7dd3fc;
}

/* TH 14 - Purple/Gold Jungle Theme */
.th-card--14:hover, .th-card--14.is-active {
    border-color: rgba(168, 85, 247, 0.45);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(168, 85, 247, 0.22);
}
.th-card--14:hover .th-card__title, .th-card--14.is-active .th-card__title {
    color: #c084fc;
}

/* TH 15 - Magic Violet Theme */
.th-card--15:hover, .th-card--15.is-active {
    border-color: rgba(236, 72, 153, 0.45);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(236, 72, 153, 0.22);
}
.th-card--15:hover .th-card__title, .th-card--15.is-active .th-card__title {
    color: #f9a8d4;
}

/* TH 16 - Nature Red/Orange Theme */
.th-card--16:hover, .th-card--16.is-active {
    border-color: rgba(251, 146, 60, 0.45);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(251, 146, 60, 0.22);
}
.th-card--16:hover .th-card__title, .th-card--16.is-active .th-card__title {
    color: #fdba74;
}

/* TH 17 - Lightning Gold Theme */
.th-card--17:hover, .th-card--17.is-active {
    border-color: rgba(250, 204, 21, 0.45);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(250, 204, 21, 0.22);
}
.th-card--17:hover .th-card__title, .th-card--17.is-active .th-card__title {
    color: #fef08a;
}

/* TH 18 - Cosmic Teal Theme */
.th-card--18:hover, .th-card--18.is-active {
    border-color: rgba(45, 212, 191, 0.45);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4), 0 0 25px rgba(45, 212, 191, 0.22);
}
.th-card--18:hover .th-card__title, .th-card--18.is-active .th-card__title {
    color: #99f6e4;
}

/* Selected Active State Styles */
.th-card.is-active {
    background: rgba(22, 42, 68, 0.65);
    transform: scale(0.98);
}

.th-card.is-active::after {
    content: '';
    position: absolute;
    bottom: 0;
    width: 40%;
    height: 3px;
    border-radius: var(--radius-full) var(--radius-full) 0 0;
    animation: pulse-line 1.8s ease-in-out infinite;
}

.th-card--13.is-active::after { background: #38bdf8; box-shadow: 0 0 8px #38bdf8; }
.th-card--14.is-active::after { background: #a855f7; box-shadow: 0 0 8px #a855f7; }
.th-card--15.is-active::after { background: #ec4899; box-shadow: 0 0 8px #ec4899; }
.th-card--16.is-active::after { background: #fb923c; box-shadow: 0 0 8px #fb923c; }
.th-card--17.is-active::after { background: #facc15; box-shadow: 0 0 8px #facc15; }
.th-card--18.is-active::after { background: #2dd4bf; box-shadow: 0 0 8px #2dd4bf; }

@keyframes pulse-line {
    0%, 100% { opacity: 0.6; width: 30%; }
    50% { opacity: 1; width: 50%; }
}

/* Bases Loading Status */
.bases-grid__status {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: 1.1rem;
    padding: var(--space-10) var(--space-4);
}

.bases-grid__status.error-state {
    color: var(--color-danger);
}

/* Hide utility */
.is-hidden {
    display: none !important;
}

/* Media Queries for Mobile Responsiveness */
@media (max-width: 576px) {
    .bases-section-title {
        font-size: 1.25rem;
        margin-top: var(--space-6);
    }
    
    .bases-section-title::before,
    .bases-section-title::after {
        width: 30px;
    }
    
    .th-selector-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on small screens to fit perfectly */
        gap: var(--space-3);
    }
    
    .th-card {
        padding: var(--space-4) var(--space-2);
        min-height: 120px;
        gap: var(--space-2);
    }
    
    .th-card__image-container {
        width: 48px;
        height: 48px;
    }
    
    .th-card__title {
        font-size: 0.85rem;
    }
}

/* Card Actions Side-by-Side Flex Layout overrides */
.trending-card__actions {
    display: flex;
    gap: var(--space-2);
    width: 100%;
}

.trending-card__actions .btn,
.trending-card__actions a.btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    font-size: 0.8rem;
    padding: 0.55rem 0.5rem;
    font-weight: 700;
    width: auto;
}

/* YouTube Video Button Style */
.btn--youtube {
    background: linear-gradient(135deg, #ff0000 0%, #cc0000 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.2);
    border: none;
    text-decoration: none;
}

.btn--youtube:hover {
    background: linear-gradient(135deg, #ff3333 0%, #ff0000 100%);
    box-shadow: 0 6px 16px rgba(255, 0, 0, 0.35);
    transform: translateY(-1px);
}

/* Scroll to Top Floating Button */
.scroll-top-btn {
    position: fixed;
    bottom: calc(var(--safe-bottom) + var(--space-4));
    right: max(var(--space-4), var(--safe-right));
    width: 46px; /* Slightly larger */
    height: 46px;
    border-radius: 50%;
    background: rgba(10, 24, 42, 0.94); /* Darker and more opaque for high contrast */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.8px solid rgba(45, 212, 191, 0.45); /* Thicker border */
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 
        0 8px 24px rgba(0, 0, 0, 0.45),
        0 0 12px rgba(45, 212, 191, 0.1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(15px);
    transition: opacity var(--transition-base), visibility var(--transition-base),
        transform var(--transition-base), background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.scroll-top-btn.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    animation: scroll-btn-pulse 2.2s infinite ease-in-out; /* Permanent breathing glow focus */
}

@keyframes scroll-btn-pulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(45, 212, 191, 0.35);
        border-color: rgba(45, 212, 191, 0.45);
    }
    50% {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px 5px rgba(45, 212, 191, 0.22);
        border-color: var(--color-primary-light); /* Highlight ring focuses the user */
    }
}

.scroll-top-btn:hover {
    background: var(--gradient-primary);
    color: #042f2e;
    border-color: transparent;
    transform: translateY(-3px);
    animation: none; /* Disable pulse on hover */
    box-shadow: 
        0 12px 28px rgba(45, 212, 191, 0.4),
        0 0 15px rgba(45, 212, 191, 0.25);
}

.scroll-top-btn:active {
    transform: translateY(-1px);
}

.scroll-top-btn svg {
    transition: transform var(--transition-fast);
}

.scroll-top-btn:hover svg {
    transform: translateY(-2px);
}

/* Mobile responsiveness alignment override */
@media (max-width: 480px) {
    .scroll-top-btn {
        width: 40px;
        height: 40px;
        bottom: calc(var(--safe-bottom) + var(--space-3));
        right: var(--space-3);
    }
}

/* Base Type Filter Buttons */
.base-filter-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-4);
    margin: 0 0 var(--space-8) 0;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.625rem 1.5rem;
    border-radius: var(--radius-lg);
    background: rgba(15, 30, 48, 0.45);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    color: var(--color-text-muted);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 300ms var(--ease-out);
    user-select: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.filter-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    background: rgba(18, 38, 62, 0.55);
}

/* Selected/Active state styling */
.filter-btn.is-active {
    background: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 8px 24px rgba(251, 146, 60, 0.35);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

.filter-btn.is-active:hover {
    background: linear-gradient(135deg, #fdba74 0%, #f97316 100%);
    box-shadow: 0 10px 28px rgba(251, 146, 60, 0.45);
}

/* Icon Colors when not active */
.filter-btn__icon {
    transition: transform 300ms var(--ease-out), color 300ms var(--ease-out);
}

.filter-btn:hover .filter-btn__icon {
    transform: scale(1.15) rotate(-3deg);
}

.filter-btn__icon--blue {
    color: var(--color-accent-blue);
}

.filter-btn__icon--swords {
    color: var(--color-accent-red);
}

.filter-btn__icon--green {
    color: var(--color-success);
}

/* Active icon style override */
.filter-btn.is-active .filter-btn__icon {
    color: #ffffff !important;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3));
}

@media (max-width: 576px) {
    .base-filter-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* Clean, highly responsive 2x2 grid for mobile */
        gap: var(--space-3);
        margin-bottom: var(--space-6);
        padding: 0 var(--space-3);
    }
    
    .filter-btn {
        width: 100%;
        padding: 0.75rem var(--space-2);
        font-size: 0.875rem;
        border-radius: var(--radius-lg);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 0;
    }
}


