:root {
    --bg-color: #0f172a;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Animated Glows */
.background-effects {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    overflow: hidden;
}
.glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: float 10s infinite ease-in-out alternate;
}
.glow-1 {
    width: 400px; height: 400px;
    background: rgba(59, 130, 246, 0.3);
    top: -100px; left: -100px;
}
.glow-2 {
    width: 500px; height: 500px;
    background: rgba(139, 92, 246, 0.2);
    bottom: -150px; right: -100px;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Glassmorphism Classes */
.glass-header {
    text-align: center;
    margin-bottom: 2rem;
}
.header-top {
    display: flex;
    justify-content: flex-start;
    margin-bottom: -30px;
    position: relative;
    z-index: 10;
}
.logout-btn {
    display: inline-flex;
    align-items: center;
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}
.logout-btn svg {
    margin-right: 6px;
}
.logout-btn:hover {
    background: rgba(239, 68, 68, 0.3);
    transform: translateY(-2px);
}
.glass-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.glass-header p {
    color: var(--text-muted);
    font-weight: 300;
}

.grid-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

/* Default Desktop Behavior */
@media (min-width: 901px) {
    .tabs { display: none; }
    .form-panel, .list-panel { display: block !important; }
}

@media (max-width: 900px) {
    .grid-layout {
        display: block; /* Remove grid to allow single item display */
    }
    .form-panel, .list-panel {
        display: none;
    }
    .form-panel.active-tab, .list-panel.active-tab {
        display: block;
        animation: fadeIn 0.3s ease;
    }
}

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

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.glass-panel h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

/* Form Styles */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
}
.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}
.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 600;
}
.form-group input, .form-group select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    outline: none;
    transition: all 0.3s ease;
}
.form-group input:focus, .form-group select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.submit-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.submit-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

#statusMessage {
    margin-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
}
th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}
th {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
td {
    font-size: 0.95rem;
}
.sync-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}
.sync-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}
.sync-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--bg-color);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}
.login-box {
    text-align: center;
    max-width: 400px;
    width: 90%;
}
.login-box input[type="password"] {
    width: 100%;
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: 2px;
}
.remember-me {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.tab-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Action Buttons */
.action-btn {
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    border: none;
    color: white;
    margin-right: 5px;
    transition: background 0.3s;
}
.btn-delete { background: #ef4444; }
.btn-delete:hover { background: #dc2626; }
.btn-qsl { background: #3b82f6; }
.btn-qsl:hover { background: #2563eb; }

/* QSL Card Retro Redesign */
.qsl-card {
    width: 800px;
    height: 480px;
    background-color: #f4ecd8; /* Vintage paper color */
    background-image: radial-gradient(#d4c3a3 1px, transparent 1px);
    background-size: 10px 10px; /* Slight dot texture */
    color: #2c2116; /* Dark brown/black ink */
    padding: 30px;
    position: relative;
    border: 10px solid #8b5a2b; /* Wooden/classic border */
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    box-sizing: border-box;
    overflow: hidden;
}

.qsl-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-20deg);
    font-size: 120px;
    font-weight: bold;
    color: rgba(139, 90, 43, 0.08); /* Faded stamp */
    pointer-events: none;
    z-index: 1;
    white-space: nowrap;
    border: 10px solid rgba(139, 90, 43, 0.08);
    padding: 20px;
    border-radius: 20px;
}

.qsl-inner {
    border: 2px solid #8b5a2b;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    z-index: 2;
    padding: 15px;
    background: rgba(244, 236, 216, 0.85); /* Slightly blur out the dots */
}

.qsl-header {
    text-align: center;
    border-bottom: 2px dashed #8b5a2b;
    padding-bottom: 10px;
}

.qsl-header h1 {
    font-size: 4.5rem;
    margin: 0;
    letter-spacing: 5px;
    color: #8b0000; /* Classic dark red */
    font-family: 'Times New Roman', Times, serif;
    font-weight: bold;
    text-shadow: 2px 2px 0px rgba(0,0,0,0.1);
}

.qsl-subtitle {
    font-size: 1.2rem;
    color: #2c2116;
    letter-spacing: 2px;
    margin: 5px 0 10px 0;
    font-weight: bold;
}

.qsl-zones {
    font-size: 1rem;
    color: #5a4634;
    font-weight: bold;
}

.qsl-body {
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.qsl-body h2 {
    font-size: 1.1rem;
    color: #2c2116;
    margin: 0 0 5px 0;
    font-family: 'Times New Roman', Times, serif;
    font-style: italic;
}

.qsl-callsign-target {
    font-size: 2.8rem;
    color: #8b0000;
    margin: 0 0 20px 0;
    letter-spacing: 3px;
    font-family: 'Times New Roman', Times, serif;
    border: 2px solid #8b0000;
    display: inline-block;
    padding: 5px 30px;
    background: #fffdf8;
    border-radius: 5px;
    white-space: nowrap;
}

.qsl-data-grid {
    display: flex;
    justify-content: center;
    gap: 0;
    margin-bottom: 15px;
    border: 2px solid #2c2116;
    background: #fffdf8;
}

.qsl-data-box {
    border-right: 2px solid #2c2116;
    padding: 10px;
    min-width: 90px;
}
.qsl-data-box:last-child {
    border-right: none;
}

.qsl-data-box span {
    display: block;
    font-size: 0.8rem;
    color: #5a4634;
    margin-bottom: 5px;
    font-weight: bold;
    border-bottom: 1px dotted #5a4634;
    padding-bottom: 5px;
}

.qsl-data-box strong {
    display: block;
    font-size: 1.3rem;
    color: #2c2116;
}

.qsl-remarks {
    font-size: 1.1rem;
    color: #2c2116;
    text-align: left;
    margin: 0;
    padding-left: 10px;
}

.qsl-footer {
    text-align: right;
    border-top: 2px dashed #8b5a2b;
    padding-top: 10px;
}

.qsl-footer p {
    margin: 0;
    font-size: 1.2rem;
    color: #2c2116;
    font-weight: bold;
    font-family: 'Times New Roman', Times, serif;
    font-style: italic;
}

@media (max-width: 600px) {
    .qsl-btn-text {
        display: none;
    }
    .hide-on-mobile {
        display: none;
    }
}

.lang-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 5px;
    background: rgba(255, 255, 255, 0.05);
    padding: 5px;
    border-radius: 8px;
    z-index: 100;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.lang-btn {
    background: transparent;
    color: #94a3b8;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.lang-btn:hover {
    color: #fff;
}

.lang-btn.active {
    background: #3b82f6;
    color: white;
}

.profile-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #cbd5e1;
    padding: 8px 16px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.profile-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    color: white;
    border-color: rgba(56, 189, 248, 0.4);
    transform: translateY(-2px);
}

.whatsapp-float {
    position: fixed;
    width: 60px;
    height: 60px;
    bottom: 30px;
    right: 30px;
    background-color: #25d366;
    color: #FFF;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0px 4px 10px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: all 0.3s ease;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    background-color: #128C7E;
}
