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

:root[data-theme="light"] {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --bg: #ffffff;
    --bg-secondary: #f8fafc;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --card: #ffffff;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

:root[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --card: #1e293b;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-secondary);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Header */
.header {
    background: var(--card);
    border-radius: 12px;
    padding: 20px 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border);
    transition: all 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-text {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.theme-toggle {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.sun-icon, .moon-icon {
    stroke-width: 2;
}

.status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 2px solid var(--border);
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: pulse 2s ease-in-out infinite;
}

.status-indicator.connected {
    background: var(--secondary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.btn-logout {
    padding: 10px 20px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* Main Content */
.main-content {
    background: var(--card);
    border-radius: 12px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border);
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.hero {
    text-align: center;
    margin-bottom: 40px;
}

.hero h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 12px;
    color: var(--primary);
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}

.tab {
    background: none;
    border: none;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: -2px;
}

.tab:hover {
    color: var(--primary);
    background: var(--bg-secondary);
    border-radius: 8px 8px 0 0;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Search Forms */
.search-panel {
    display: none;
    animation: fadeIn 0.3s ease;
}

.search-panel.active {
    display: block;
}

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

.search-form {
    max-width: 600px;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    border: 2px solid var(--border);
    border-radius: 10px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    color: white;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Results */
.results-section {
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid var(--border);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
}

.results-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.results-count {
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    border: 2px solid var(--border);
}

.results-grid {
    display: grid;
    gap: 20px;
}

.result-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s ease;
}

.result-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.result-field {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.result-field:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.result-field strong {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-field span {
    color: var(--text);
    font-size: 15px;
    font-weight: 500;
}

/* Footer */
.footer {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    background: var(--card);
    border-radius: 12px;
    border: 2px solid var(--border);
}

.footer p {
    margin: 0;
    font-weight: 600;
}

.footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    transition: all 0.3s ease;
    border: 2px solid var(--border);
}

.footer a:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Login Page */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #2563eb;
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    border: 4px solid #10b981;
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-title {
    font-size: 32px;
    font-weight: 800;
    color: #2563eb;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.login-subtitle {
    text-align: center;
    color: #64748b;
    font-size: 16px;
    margin-bottom: 32px;
}

.access-form .input-wrapper {
    margin-bottom: 24px;
}

.access-form input {
    width: 100%;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-align: center;
    letter-spacing: 2px;
}

.access-form input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.access-form input.error {
    border-color: #ef4444;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.error-msg {
    padding: 12px 16px;
    background: #fef2f2;
    border: 2px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
    font-size: 14px;
    margin-bottom: 20px;
    font-weight: 600;
}

.error-msg.hidden {
    display: none;
}

.btn-access {
    width: 100%;
    padding: 16px 28px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.btn-access:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.3);
}

.btn-access:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.login-footer {
    text-align: center;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 2px solid #e2e8f0;
    color: #64748b;
    font-size: 14px;
    font-weight: 600;
}

/* Utilities */
.hidden {
    display: none !important;
}

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

    .main-content {
        padding: 24px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .hero p {
        font-size: 16px;
    }

    .tabs {
        flex-direction: column;
        border-bottom: none;
    }

    .tab {
        width: 100%;
        justify-content: center;
        border-bottom: 2px solid var(--border);
        border-radius: 8px;
        margin-bottom: 8px;
    }

    .tab.active {
        background: var(--bg-secondary);
        border-color: var(--primary);
    }

    .result-field {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .results-actions {
        width: 100%;
        justify-content: space-between;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }

    .header {
        flex-direction: column;
        gap: 16px;
    }

    .header-actions {
        width: 100%;
        justify-content: space-between;
    }

    .logo-text {
        font-size: 20px;
    }
}
