:root {
    --bg-color: #0a0a0a;
    --text-color: #ffffff;
    --text-muted: #a0a0a0;
    --primary-color: #6d28d9;
    --secondary-color: #4c1d95;
    --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #2563eb 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Space Grotesk', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Common Buttons */
.btn {
    padding: 0.8rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    border: none;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-sm {
    padding: 0.5rem 1.2rem;
    font-size: 0.9rem;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.5);
    transform: translateY(-2px);
}

/* Database Section */
.database-section {
    padding: 4rem 0;
    background: #080808;
    min-height: 100vh;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-header p {
    color: var(--text-muted);
    font-size: 1.2rem;
}

.database-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.control-group {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.tab-buttons {
    display: flex;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    border-radius: 50px;
}

.btn-tab {
    padding: 0.6rem 1.5rem;
    border-radius: 50px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-tab.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 300px;
}

.search-box i {
    position: absolute;
    left: 1.2rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: var(--font-body);
    font-size: 1rem;
}

.search-box input:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

/* Map */
.map-container {
    height: 400px;
    width: 100%;
    border-radius: 16px;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    z-index: 1;
    /* Ensure map is below dropdowns if any */
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    min-height: 200px;
    animation: fadeIn 0.5s ease-out;
}

.tower-card {
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s ease, border-color 0.2s ease;
    position: relative;
    overflow: hidden;
}

.tower-card:hover {
    transform: translateY(-5px);
    border-color: #7c3aed;
}

.tower-card.stopcell {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.4);
}

.tower-card.stopcell:hover {
    border-color: #22c55e;
}


.tower-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 1rem;
}

.tower-id {
    background: rgba(124, 58, 237, 0.1);
    color: #a78bfa;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 700;
}

.tower-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: white;
}

.tower-details {
    display: grid;
    gap: 0.8rem;
    font-size: 0.9rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
}

.detail-label {
    color: var(--text-muted);
}

.detail-value {
    font-weight: 600;
    text-align: right;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 0.5rem;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-stopsell {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Modal Styles */
.modal {
    display: flex;
    /* Hidden by default via .hidden class, but flex when active */
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none !important;
    opacity: 0;
}

.modal-content {
    background: #1a1a1a;
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease-out;
}

.close-modal {
    color: var(--text-muted);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
    line-height: 1;
}

.close-modal:hover {
    color: #fff;
}

.modal-header h3 {
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
    color: white;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.modal-row {
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.modal-label {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.modal-value {
    font-weight: 600;
    color: white;
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.modal-footer {
    margin-top: 2rem;
    text-align: right;
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
}

/* Pagination */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    margin-top: 3rem;
}

.loading-spinner {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    .database-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        flex-direction: column;
        width: 100%;
    }

    .tab-buttons {
        width: 100%;
        justify-content: center;
    }

    .search-box {
        width: 100%;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}