/* Prominent CTA link style for helper anchors */
.cta-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 8px;
    color: #ffffff !important;
    text-decoration: none;
    font-weight: 600;
    line-height: 1.2;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    /* transition: background 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease; */
    /* border: 1px solid rgba(255, 255, 255, 0.08); */
}

.cta-link::after {
    content: "↗";
    font-size: 0.9em;
    opacity: 0.9;
}
:root {
    --bg-body: #0f172a; /* Slate 900 */
    --bg-card: #1e293b; /* Slate 800 */
    --bg-input: #020617; /* Slate 950 */
    --text-main: #f1f5f9; /* Slate 100 */
    --text-muted: #94a3b8; /* Slate 400 */
    --primary: #3b82f6; /* Blue 500 */
    --primary-hover: #2563eb; /* Blue 600 */
    --border: #334155; /* Slate 700 */
    --success: #10b981;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 8px;
}

body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* Header */
#app-header {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 1.5rem;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1.5rem;
    position: sticky;
    top: 0;
    z-index: 50;
}

#app-header img {
    width: 42px;
    height: 42px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

#app-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.025em;
}

#app-header p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-right a.logout-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header-right a.logout-btn:hover {
    background: var(--border);
}

#api-usage-counter {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    color: var(--primary);
    font-family: 'JetBrains Mono', monospace;
}

/* Nav Buttons */
#nav-buttons {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    flex-wrap: wrap;
}

.nav-button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-button:hover {
    background: var(--border);
    color: var(--text-main);
}

.nav-button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

.nav-button img {
    width: 20px;
    height: 20px;
    filter: brightness(0) invert(1); /* Make icons white if they aren't */
    opacity: 0.7;
}
.nav-button.active img, .nav-button:hover img {
    opacity: 1;
}

/* Content Area */
#content-area {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem 3rem 1rem;
}

.content-module {
    display: none;
    animation: fadeIn 0.3s ease-out;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    margin-top: 10px;
}

.content-module.active {
    display: block;
}

.content-module h2 {
    margin-top: 0;
    font-size: 1.5rem;
    color: var(--text-main);
}

.content-module p {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* Forms */
form {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

form input[type="text"] {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

form input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

form button[type="submit"] {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

form button[type="submit"]:hover {
    background: var(--primary-hover);
}

/* Results */
.results-container {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.terminal-card {
    background: #020617;
    border: 1px solid #1e293b;
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
}

.terminal-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 4px; height: 100%;
    background: var(--primary);
}

.terminal-card .data-row {
    display: flex;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed #334155;
    padding-bottom: 0.5rem;
}
.terminal-card .data-row:last-child {
    border-bottom: none;
}

.terminal-card .key {
    color: #64748b;
    width: 140px;
    flex-shrink: 0;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.terminal-card .value {
    color: #e2e8f0;
    word-break: break-all;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .terminal-card .data-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    .terminal-card .key {
        width: auto;
    }
    #app-header {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 1rem;
        gap: 0rem
    }

    #app-header img {
        margin: 0 auto 0.5rem auto;
        display: block;
    }

    .header-right {
        justify-content: center;
        margin-top: 0.5rem;
    }

    form {
        flex-direction: column;
    }

    form button[type="submit"] {
        width: 100%;
    }
}

/* Mobile Drawer / Nav */
#mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
    position: absolute;
    left: 1rem;
    top: 1.2rem;
}

.nav-close-btn {
    display: none;
}

@media (max-width: 600px) {
    #mobile-menu-toggle {
        display: block;
    }

    #nav-buttons {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 250px;
        background: var(--bg-card);
        flex-direction: column;
        justify-content: flex-start;
        padding: 60px 1rem 1rem 1rem;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--border);
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
        gap: 0.5rem; /* REDUCED GAP */
    }

    #nav-buttons.nav-open {
        transform: translateX(0);
    }

    .nav-close-btn {
        display: block;
        position: absolute;
        top: 15px;
        right: 15px;
        background: transparent;
        border: none;
        color: var(--text-muted);
        font-size: 1.5rem;
        cursor: pointer;
        z-index: 101;
    }
    .nav-close-btn:hover {
        color: var(--text-main);
    }

    /* REDUCED HEIGHT FOR MOBILE NAV BUTTONS */
    .nav-button {
        width: 100%;
        padding: 10px 12px; /* REDUCED PADDING */
        font-size: 0.9rem;
        border: 1px solid transparent;
        background: transparent;
    }

    .nav-button:hover, .nav-button.active {
        background: rgba(59, 130, 246, 0.1);
        color: var(--primary);
        border: 1px solid rgba(59, 130, 246, 0.2);
        box-shadow: none;
    }

    #nav-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.6);
        z-index: 90;
        backdrop-filter: blur(2px);
    }

    #nav-overlay.active {
        display: block;
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Login Page Compatibility */
.login-wrapper {
    min-height: calc(100vh - 40px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.login-card {
    width: 360px;
    max-width: 90%;
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    text-align: center;
}

.login-title {
    color: var(--text-main);
    font-size: 1.9rem;
    margin: 0 0 1.25rem 0;
    letter-spacing: 1px;
    font-weight: 700;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.input-group {
    display: flex;
    align-items: center;
    background: var(--bg-input);
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.input-group .icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 44px;
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    flex-shrink: 0;
}

.input-group input {
    border: none;
    outline: none;
    padding: 0.9rem;
    font-size: 1rem;
    background: transparent;
    color: var(--text-main);
    width: 100%;
}

.login-btn {
    margin-top: 0.5rem;
    padding: 0.95rem 1rem;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
}

.login-btn:hover {
    background: var(--primary-hover);
}

/* Map Container */
.map-container {
    margin-top: 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    height: 200px;
    width: 100%;
}

.map-frame {
    width: 100%;
    height: 100%;
    border: 0;
    pointer-events: auto; 
    filter: invert(90%) hue-rotate(180deg) contrast(90%);
}

/* --- Profile Section Styling --- */

/* Desktop Profile Button */
.desktop-profile-wrapper {
    position: relative;
    display: inline-block;
}

.profile-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.profile-btn:hover {
    background: var(--border);
}

/* Desktop Dropdown */
.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 110%;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    z-index: 1000;
}

/* Show dropdown on hover (simple interaction) */
.desktop-profile-wrapper:hover .profile-dropdown {
    display: block;
}

/* Profile Table */
.profile-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.profile-table th {
    text-align: left;
    color: var(--text-muted);
    padding: 6px 4px;
    border-bottom: 1px dashed var(--border);
}

.profile-table td {
    padding: 8px 4px;
    color: var(--text-main);
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
}

.profile-table tr:last-child td {
    border-bottom: none;
}

/* Mobile Profile Section */
.mobile-profile-section {
    display: none; /* Hidden on desktop */
    padding: 0 0.5rem 1.5rem 0.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    width: 100%;
}

.mobile-sub-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 8px;
}

/* Responsiveness */
@media (max-width: 600px) {
    .desktop-profile-wrapper {
        display: none; /* Hide header dropdown on mobile */
    }

    .mobile-profile-section {
        display: block; /* Show inside drawer on mobile */
    }
}

#profile-img{
    width: 60px;
    border-radius: 100%;
}