* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #0a1628;
    min-height: 100vh;
    color: #e0e6ed;
    transition: background 0.3s, color 0.3s;
}

/* ===== TOP BAR ===== */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, #0f1f3a, #1a2d4a);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.top-title {
    font-size: 2.2em;
    font-weight: 900;
    letter-spacing: 3px;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-link-btn {
    display: inline-block;
    font-size: 0.95rem;
    color: #00ffaa;
    text-decoration: none;
    padding: 8px 28px;
    border-radius: 24px;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 2px solid #00ffaa;
    transition: all 0.2s;
}

.nav-link-btn:hover {
    background: #00ffaa;
    color: #0a1628;
    box-shadow: 0 0 20px rgba(0, 255, 170, 0.3);
}

/* ===== THEME TOGGLE ===== */
.theme-toggle-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #111d32;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.theme-label {
    font-size: 18px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #00c97b;
    border-radius: 26px;
    transition: 0.3s;
}

.slider:before {
    content: "";
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.3s;
}

.switch input:checked+.slider {
    background: #fbbf24;
}

.switch input:checked+.slider:before {
    transform: translateX(24px);
}

/* ===== MAIN ===== */
.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 24px 16px;
}

.card {
    background: #111d32;
    border: 1px solid #1e2d45;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 20px;
    transition: background 0.3s, border-color 0.3s;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: #e0e6ed;
    margin-bottom: 16px;
}

.input-label {
    font-size: 14px;
    font-weight: 600;
    color: #8899aa;
    margin-bottom: 8px;
    display: block;
}

.key-textarea {
    width: 100%;
    border: 1px solid #2a3b55;
    border-radius: 10px;
    padding: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    resize: vertical;
    min-height: 120px;
    outline: none;
    transition: border-color 0.2s, background 0.3s, color 0.3s;
    background: #0a1628;
    color: #e0e6ed;
}

.key-textarea:focus {
    border-color: #00c97b;
    box-shadow: 0 0 0 3px rgba(0, 201, 123, 0.15);
}

.input-hint {
    font-size: 13px;
    color: #6b7a8d;
    margin-top: 8px;
    font-style: italic;
}

.get-code-btn {
    margin-top: 16px;
    background: transparent;
    color: #00c97b;
    border: 2px solid #00c97b;
    padding: 10px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.get-code-btn:hover {
    background: #00c97b;
    color: #0a1628;
}

.get-code-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ===== RESULTS ===== */
.result-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid #1e2d45;
    align-items: flex-start;
}

.result-row:last-child {
    border-bottom: none;
}

.result-col {
    flex: 1;
    min-width: 120px;
}

.col-time {
    flex: 0 0 100px;
    text-align: center;
}

.col-key {
    flex: 2;
}

.result-label {
    font-size: 12px;
    font-weight: 700;
    color: #6b7a8d;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.code-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.code-value {
    background: rgba(0, 201, 123, 0.15);
    color: #00ffaa;
    font-size: 20px;
    font-weight: 800;
    padding: 6px 16px;
    border-radius: 8px;
    letter-spacing: 3px;
    font-family: 'Inter', monospace;
}

.copy-btn {
    background: none;
    border: none;
    color: #00c97b;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    transition: background 0.15s;
}

.copy-btn:hover {
    background: rgba(0, 201, 123, 0.1);
}

.time-value {
    font-size: 16px;
    font-weight: 700;
    color: #ef4444;
}

.time-value.expired {
    color: #666;
}

.key-value {
    background: #0a1628;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-family: monospace;
    color: #8899aa;
    word-break: break-all;
    border: 1px solid #1e2d45;
}

.error-value {
    color: #ef4444;
    font-weight: 600;
    font-size: 14px;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #6b7a8d;
    font-size: 14px;
}

/* =======================================
   LIGHT THEME
   ======================================= */
body[data-theme="light"] {
    background: #f5f7fa;
    color: #2c3e50;
}

body[data-theme="light"] .top-bar {
    background: linear-gradient(135deg, #2c3e50, #34495e);
}

body[data-theme="light"] .theme-toggle-bar {
    background: #e8edf3;
    border-bottom-color: #d5dbe3;
}

body[data-theme="light"] .card {
    background: #fff;
    border-color: #e6e8ec;
}

body[data-theme="light"] .card-title {
    color: #1a1a2e;
}

body[data-theme="light"] .input-label {
    color: #555;
}

body[data-theme="light"] .key-textarea {
    background: #fff;
    color: #333;
    border-color: #d0d5dd;
}

body[data-theme="light"] .key-textarea:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

body[data-theme="light"] .input-hint {
    color: #888;
}

body[data-theme="light"] .get-code-btn {
    background: linear-gradient(135deg, #2563eb, #4f46e5);
}

body[data-theme="light"] .result-row {
    border-bottom-color: #f0f0f5;
}

body[data-theme="light"] .result-label {
    color: #888;
}

body[data-theme="light"] .code-value {
    background: #eef2ff;
    color: #2563eb;
}

body[data-theme="light"] .copy-btn {
    color: #2563eb;
}

body[data-theme="light"] .copy-btn:hover {
    background: #eef2ff;
}

body[data-theme="light"] .key-value {
    background: #f3f4f6;
    color: #555;
    border-color: #e6e8ec;
}

body[data-theme="light"] .loading {
    color: #888;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .top-title {
        font-size: 1.8em;
        letter-spacing: 2px;
    }

    .nav-link-btn {
        font-size: 0.8rem;
        padding: 6px 16px;
    }

    .card {
        padding: 20px 16px;
        border-radius: 12px;
    }

    .card-title {
        font-size: 16px;
    }

    .key-textarea {
        font-size: 13px;
        min-height: 100px;
    }
}

@media (max-width: 480px) {
    .top-title {
        font-size: 1.4em;
        letter-spacing: 1px;
    }

    .nav-row {
        gap: 8px;
    }

    .nav-link-btn {
        font-size: 0.75rem;
        padding: 5px 12px;
    }

    .app-container {
        padding: 16px 10px;
    }

    .card {
        padding: 16px 12px;
    }

    .result-row {
        flex-direction: column;
        gap: 10px;
    }

    .col-time {
        text-align: left;
    }

    .code-value {
        font-size: 18px;
        padding: 5px 12px;
        letter-spacing: 2px;
    }

    .key-value {
        font-size: 11px;
    }

    .theme-toggle-bar {
        padding: 8px;
    }
}