:root {
    --bg-color: #050505;
    --card-bg: rgba(20, 20, 20, 0.6);
    --card-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #818cf8 100%);
    --button-bg: rgba(255, 255, 255, 0.03);
    --button-hover: rgba(255, 255, 255, 0.08);
    --success-color: #34d399;
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(at 0% 0%, rgba(56, 189, 248, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(129, 140, 248, 0.05) 0px, transparent 50%);
}

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

header {
    text-align: center;
    margin-bottom: 4rem;
    padding-top: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, border-color 0.3s ease;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(56, 189, 248, 0.5);
}

/* Glowing Effect Overlay */
.card-glow {
    pointer-events: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
    /* The gradient is positioned via JS variables --x and --y */
    background: radial-gradient(600px circle at var(--x, 50%) var(--y, 50%),
            rgba(56, 189, 248, 0.1),
            transparent 40%);
}

.card:hover .card-glow {
    opacity: 1;
}

/* Ensure content stays on top of glow */
.card>*:not(.card-glow) {
    position: relative;
    z-index: 1;
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-icon {
    font-size: 1.5rem;
}

ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

a {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--button-bg);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: 9999px;
    font-weight: 500;
    transition: all 0.2s ease;
    border: 1px solid var(--card-border);
}

a:hover {
    background: var(--button-hover);
    border-color: rgba(56, 189, 248, 0.3);
    padding-left: 1.25rem;
}

code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--text-secondary);
    display: block;
    margin-top: 0.25rem;
    font-family: 'Fira Code', monospace;
}

.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-active {
    background-color: var(--success-color);
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.4);
}

/* Config Form Styles */
.config-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    font-family: 'Fira Code', monospace;
}

.form-group input {
    background: rgba(10, 10, 10, 0.6);
    border: 1px solid var(--card-border);
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: 'Fira Code', monospace;
    transition: all 0.2s ease;
    width: 100%;
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.1);
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: color 0.2s ease, background 0.2s ease;
}

.password-toggle:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

.form-divider {
    grid-column: 1 / -1;
    height: 1px;
    background: var(--card-border);
    margin: 1rem 0;
}

.save-btn {
    grid-column: 1 / -1;
    background: var(--accent-color);
    color: #000;
    padding: 0.875rem;
    border: none;
    border-radius: 9999px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease;
    margin-top: 1rem;
    font-size: 1rem;
}

.save-btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.status-msg {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.9rem;
    min-height: 1.5rem;
}

.status-msg.success {
    color: var(--success-color);
}

.status-msg.error {
    color: #ef4444;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    h1 {
        font-size: 2rem;
    }
}

/* Subpage Styles */
.json-output {
    background: rgba(10, 10, 10, 0.8);
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid var(--card-border);
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    color: #cbd5e1;
    margin-top: 2rem;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    margin-bottom: 2rem;
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 0.5rem 1.25rem;
}

.back-btn:hover {
    background: var(--button-hover);
    color: var(--text-primary);
    border-color: var(--accent-color);
}

/* ===== LICENSE STYLES ===== */

/* License Badge */
.license-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: fadeIn 0.5s ease-out;
    transition: all 0.3s ease;
}

.license-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

/* License Modal Improvements */
.modal-content {
    background: #1e293b;
    padding: 2.5rem;
    border-radius: 16px;
    width: 400px;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

.modal-content h2 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #f8fafc;
    text-align: center;
    font-size: 1.5rem;
}

.auth-form input {
    width: 100%;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #f8fafc;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: #3b82f6;
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.auth-form button {
    width: 100%;
    margin-bottom: 0.75rem;
    padding: 0.75rem;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-accent {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    font-weight: 500;
    /* Consistent with .auth-form button */
    padding: 0.75rem;
    /* Consistent with .auth-form button */
    border-radius: 8px;
    /* Consistent with .btn-primary */
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-accent:hover {
    transform: translateY(-1px);
    /* Consistent with .btn-primary:hover */
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
    /* Adjusted for accent color */
}

.btn-secondary {
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    color: #f8fafc;
    border-color: #94a3b8;
    background: rgba(255, 255, 255, 0.05);
}

/* Logout Button */
.logout-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: none;
    /* Hidden by default */
    margin-left: 1rem;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* License Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(20, 20, 20, 0.95));
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease-out;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: rotate(90deg);
}

.modal-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.license-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.license-form input {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Fira Code', monospace;
    transition: all 0.3s ease;
}

.license-form input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
}

.license-form .btn-primary {
    padding: 1rem 2rem;
    background: var(--accent-gradient);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.license-form .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(56, 189, 248, 0.4);
}

.license-form .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.license-form .btn-secondary {
    padding: 1rem 2rem;
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.license-form .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.license-message {
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.875rem;
    margin-bottom: 1rem;
    text-align: center;
}

.license-message.success {
    background: rgba(52, 211, 153, 0.1);
    border: 1px solid rgba(52, 211, 153, 0.3);
    color: #34d399;
}

.license-message.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.license-info {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 1.5rem;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}