:root {
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --border-color: #334155;
    --accent-red: #ef4444;
    --accent-green: #10b981;
    --callsign-color: #60a5fa;
    --input-bg: #0f172a;
    --footer-bg: rgba(30, 41, 59, 0.5);
    --modal-bg: rgba(15, 23, 42, 0.8);
    --btn-hover-bg: rgba(255, 255, 255, 0.05);
    --gradient-bg-1: #1e293b;
    --gradient-bg-2: #0f172a;
    
    --h-header: 10vh;
    --h-activities: 120vh;
    --h-spots: 120vh;
    --h-footer: 10vh;
}

[data-theme="light"] {
    --bg-color: #f1f5f9;
    --card-bg: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --border-color: #cbd5e1;
    --accent-red: #dc2626;
    --accent-green: #059669;
    --callsign-color: #2563eb;
    --input-bg: #ffffff;
    --footer-bg: rgba(255, 255, 255, 0.5);
    --modal-bg: rgba(241, 245, 249, 0.8);
    --btn-hover-bg: rgba(0, 0, 0, 0.05);
    --gradient-bg-1: #ffffff;
    --gradient-bg-2: #f1f5f9;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Container for centered login */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
    min-height: 100vh;
    background: radial-gradient(circle at top right, var(--gradient-bg-1), var(--gradient-bg-2));
}

.login-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 3rem;
    border-radius: 1rem;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.8s ease-out;
}

.login-card h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);

    background-clip: text;

    -webkit-text-fill-color: transparent;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Buttons */
.btn-primary {
    display: inline-block;
    background-color: var(--primary-color);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    display: inline-block;
    background-color: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    text-decoration: none;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background-color: var(--btn-hover-bg);
    color: var(--text-primary);
}

/* Dashboard */
.dashboard-container {
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 1px;
}

main {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}

.profile-card,
.data-card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.profile-card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s;
}


.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Table styling */
.data-card h3 {
    margin-bottom: 0.2rem;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
}

td.callsign {
    font-weight: 600;
    color: var(--callsign-color);
}

.positive-snr {
    color: var(--accent-green);
}

.negative-snr {
    color: var(--accent-red);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* Admin Tabs */
.admin-container {
    max-width: 1400px;
}

.admin-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: 0.5rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--btn-hover-bg);
}

.tab-btn.active {
    color: #fff;
    background: var(--primary-color);
}

/* Admin Data Card */
.admin-main {
    display: block;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: auto;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeIn 0.3s ease-out;
}

#form-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1.5rem;
}

.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: var(--text-secondary);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
}

.close-btn:hover {
    color: #fff;
}

/* Action Buttons in Table */
.btn-action {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.2rem 0.5rem;
    border-radius: 0.3rem;
    transition: background 0.2s;
}

.btn-action.edit {
    color: var(--callsign-color);
}

.btn-action.edit:hover {
    background: rgba(96, 165, 250, 0.1);
}

.btn-action.delete {
    color: #ef4444;
}

.btn-action.delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* Custom Checkbox */
.custom-checkbox {
    width: auto !important;
    transform: scale(1.5);
    margin-top: 0.5rem;
}

/* Index Strict Layout */
.index-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    overflow-x: hidden;
}

.index-layout>header {
    height: 15vh;
    flex-shrink: 0;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.index-layout>main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    gap: 2rem;
}

.index-layout .activities-block,
.index-layout .spots-block {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 30vh;
    height: auto;
}

.index-layout .data-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 2rem;
}

.index-layout .table-container {
    overflow-x: auto;
    overflow-y: visible;
    margin-top: 1rem;
    height: auto;
    max-height: none;
}

.index-layout>footer {
    height: 15vh;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--footer-bg);
    border-top: 1px solid var(--border-color);
    overflow: hidden;
    position: relative;
    padding-top: 1rem;
}

/* Carousel */
.carousel-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
    display: flex;
    align-items: center;
    height: 100%;
}

.carousel-track {
    display: inline-flex;
    gap: 3rem;
    padding: 0 2rem;
    animation: scroll-left 30s linear infinite;
    align-items: center;
}

.carousel-track:hover {
    animation-play-state: paused;
}

.carousel-item {
    display: inline-block;
    transition: transform 0.2s;
}

.carousel-item:hover {
    transform: scale(1.1);
}

.carousel-item img {
    height: calc(var(--h-footer) * 0.6);
    /* 60% of footer height */
    max-height: 60px;
    object-fit: contain;
    filter: grayscale(0.5);
    transition: filter 0.2s;
}

.carousel-item:hover img {
    filter: grayscale(0);
}

@keyframes scroll-left {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }

    /* Assumes track content is duplicated */
}

/* ==========================================================================
   DASHBOARD CLASSES
   ========================================================================== */
.responsive-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.responsive-activity-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)) auto;
    gap: 1rem;
    align-items: end;
    margin-bottom: 2rem;
}

/* ==========================================================================
   RESPONSIVE DESIGN (Mobile & Tablets)
   ========================================================================== */
@media (max-width: 768px) {

    /* 1. Unlock index layout height */
    .index-layout {
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
    }

    .index-layout>header {
        height: auto;
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
        text-align: center;
    }

    .index-layout>main {
        height: auto;
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    /* 2. Unlock card heights */
    .index-layout .activities-block,
    .index-layout .spots-block {
        height: auto !important;
        min-height: 400px;
        flex: none;
    }

    /* 3. Horizontal scrolling inside tables */
    .table-container {
        overflow-x: auto;
        max-height: 500px;
    }

    table th,
    table td {
        white-space: nowrap;
        /* Don't wrap text, let user scroll sideways */
    }

    .index-layout>footer {
        height: auto;
        padding: 1.5rem 1rem;
        min-height: 20vh;
    }

    /* 4. Admin layout adjustments */
    .admin-layout {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .admin-tabs {
        width: 100%;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        white-space: nowrap;
        padding: 1rem;
        justify-content: flex-start;
    }

    .tab-btn {
        width: auto;
        text-align: center;
    }

    .admin-main {
        padding: 1rem;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
        padding: 1.5rem;
    }

    /* 5. Dashboard layout adjustments */
    .dashboard-container {
        padding: 1rem;
    }

    .dashboard-container header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .dashboard-container>main {
        grid-template-columns: 1fr !important;
    }

    .responsive-grid-2 {
        grid-template-columns: 1fr;
    }

    .responsive-activity-form {
        grid-template-columns: 1fr;
    }

    .responsive-activity-form .btn-primary {
        width: 100%;
        margin-top: 0.5rem;
    }

    #form-fields {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   FLATPICKR CONFIRM PLUGIN STYLING
   ========================================================================== */
.flatpickr-confirm {
    background-color: var(--primary-color) !important;
    color: #fff !important;
    cursor: pointer !important;
    padding: 10px 15px !important;
    text-align: center !important;
    font-weight: bold !important;
    border-radius: 0 0 5px 5px !important;
    display: block !important;
    transition: background-color 0.2s !important;
}

.flatpickr-confirm:hover {
    background-color: var(--primary-hover) !important;
}

.flatpickr-confirm svg {
    fill: #fff !important;
    margin-right: 5px !important;
}