/* CSS Variables for Theme */
:root {
    --bg-color: #f8fafc;
    --text-color: #1e293b;
    --container-bg: #ffffff;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --border-color: #e2e8f0;
    --input-bg: #f8fafc;
    --error-bg: #fef2f2;
    --error-text: #dc2626;
    --success-bg: #f0fdf4;
    --success-text: #16a34a;
    --shadow-color: rgba(0, 0, 0, 0.08);
    --gradient-start: #f8fafc;
    --gradient-end: #e2e8f0;
}

/* Dark Mode */
.dark-mode {
    --bg-color: #0f172a;
    --text-color: #e2e8f0;
    --container-bg: #1e293b;
    --primary-color: #60a5fa;
    --primary-hover: #3b82f6;
    --border-color: #334155;
    --input-bg: #1e293b;
    --error-bg: #7f1d1d;
    --error-text: #fca5a5;
    --success-bg: #14532d;
    --success-text: #86efac;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --gradient-start: #1e293b;
    --gradient-end: #334155;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-color);
    transition: background 0.3s ease;
}

/* Login Container */
.login-container {
    background: var(--container-bg);
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px var(--shadow-color);
    width: 100%;
    max-width: 400px;
    position: relative;
    overflow: hidden;
    transition: background 0.3s ease;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.1); opacity: 0.3; }
}

.login-container h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* Inputs */
.inputs {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--border-color);
    font-size: 1.1rem;
}

input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
    background: var(--input-bg);
    color: var(--text-color);
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--container-bg);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Buttons */
#loginBtn, #registerBtn {
    width: 100%;
    padding: 0.8rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

#loginBtn:hover, #registerBtn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

#loginBtn:active, #registerBtn:active {
    transform: translateY(0);
}

/* Links */
.reset-password, .register-link, .login-link {
    display: block;
    text-align: center;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    margin: 1rem 0;
    transition: color 0.2s;
    position: relative;
    z-index: 1;
}

.reset-password:hover, .register-link:hover, .login-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Terms */
.terms-container {
    font-size: 0.9rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
    opacity: 0.8;
}

.terms-container a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.terms-container a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Error Text */
.error-text {
    color: var(--error-text);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
    background: var(--error-bg);
    border-radius: 6px;
    border: 1px solid var(--error-text);
    display: none;
    position: relative;
    z-index: 1;
}

/* Captcha */
.h-captcha {
    margin-bottom: 1.5rem;
    position: relative;
    z-index: 1;
}

/* Loading Spinner */
#loadingSpinner {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99999;
    justify-content: center;
    align-items: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 6px solid var(--border-color);
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Message Box */
#msgBox {
    display: none;
    margin: 10px 0;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    position: relative;
    z-index: 1;
}

.success {
    background: var(--success-bg);
    color: var(--success-text);
    border: 1px solid var(--success-text);
}

.error {
    background: var(--error-bg);
    color: var(--error-text);
    border: 1px solid var(--error-text);
}

/* Responsive Design */
@media (max-width: 480px) {
    .login-container {
        padding: 1.5rem;
        margin: 1rem;
    }

    .login-container h2 {
        font-size: 1.5rem;
    }
}
