/* General Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Light Theme Variables */
:root {
    --bg-color: #f4f6f9;
    --login-bg: #ffffff;
    --text-color: #333333;
    --heading-color: #2c3e50;
    --border-color: #dddddd;
    --input-focus: #3498db;
    --error-bg: #ffebee;
    --error-text: #c62828;
    --success-bg: #e8f5e9;
    --success-text: #2e7d32;
    --shadow-light: rgba(0, 0, 0, 0.08);
    --shadow-medium: rgba(0, 0, 0, 0.05);
    --label-color: #555555;
    --placeholder-color: #999999;
    
    /* Button Colors */
    --btn-primary: #3498db;
    --btn-primary-hover: #2980b9;
    --btn-text: #ffffff;
    
    /* Form Styles */
    --form-bg: #ffffff;
    --input-bg: #ffffff;
    --input-border: #dddddd;
    --input-border-hover: #bbbbbb;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-color: #1a1a2e;
    --login-bg: #16213e;
    --text-color: #e6e6e6;
    --heading-color: #ffffff;
    --border-color: #2d3748;
    --input-focus: #4895ef;
    --error-bg: #581818;
    --error-text: #ff6b6b;
    --success-bg: #1b4332;
    --success-text: #90ee90;
    --shadow-light: rgba(0, 0, 0, 0.3);
    --shadow-medium: rgba(0, 0, 0, 0.2);
    --label-color: #cccccc;
    --placeholder-color: #aaaaaa;
    
    /* Dark Theme Button Colors */
    --btn-primary: #4895ef;
    --btn-primary-hover: #4361ee;
    
    /* Dark Form Styles */
    --form-bg: #16213e;
    --input-bg: #1a1a2e;
    --input-border: #2d3748;
    --input-border-hover: #444444;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-color) 0%, #2c3e50 100%);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Mode Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--btn-primary);
    color: var(--btn-text);
    border: none;
    padding: 10px 18px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--btn-transition);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.theme-toggle:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.login-container {
    background-color: var(--login-bg);
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--shadow-light);
    width: 100%;
    max-width: 450px;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    color: var(--heading-color);
    font-size: 2rem;
    margin-bottom: 10px;
    transition: color 0.3s ease;
}

.login-header p {
    color: var(--label-color);
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

/* Message Styles */
.message {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-weight: 500;
    text-align: center;
}

.message.error {
    background-color: var(--error-bg);
    color: var(--error-text);
}

.message.success {
    background-color: var(--success-bg);
    color: var(--success-text);
}

/* Form Styles */
form {
    background-color: var(--form-bg);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

form table {
    width: 100%;
    border-collapse: collapse;
}

form td {
    padding: 15px 0;
    vertical-align: top;
}

form td:first-child {
    width: 35%;
    text-align: left;
    font-weight: 600;
    color: var(--label-color);
    transition: color 0.3s ease;
}

form label {
    display: block;
    margin-bottom: 8px;
    font-size: 1rem;
}

form input[type="text"],
form input[type="password"] {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
}

form input[type="text"]:focus,
form input[type="password"]:focus {
    outline: none;
    border-color: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

form input[type="text"]:hover,
form input[type="password"]:hover {
    border-color: var(--input-border-hover);
}

/* Submit Button */
.submit-btn {
    background: linear-gradient(135deg, var(--btn-primary) 0%, var(--btn-primary-hover) 100%);
    color: var(--btn-text);
    border: none;
    padding: 14px 25px;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.submit-btn:active {
    transform: translateY(0);
}

/* Default Login Info */
.default-login {
    text-align: center;
    margin-top: 25px;
    padding: 20px;
    background-color: rgba(52, 152, 219, 0.1);
    border-radius: 8px;
    border-left: 4px solid var(--btn-primary);
}

.default-login em {
    color: var(--label-color);
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .login-container {
        padding: 30px 20px;
    }

    .login-header h1 {
        font-size: 1.7rem;
    }

    form {
        padding: 20px 15px;
    }

    form td {
        display: block;
        width: 100%;
        padding: 10px 0;
    }

    form td:first-child {
        width: 100%;
        text-align: left;
        padding-bottom: 5px;
    }

    .theme-toggle {
        top: 15px;
        right: 15px;
        padding: 8px 15px;
        font-size: 0.8rem;
    }
}

/* Animation for theme transition */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Focus-visible polyfill */
form input:focus-visible {
    outline: 2px solid var(--input-focus);
    outline-offset: 2px;
}

/* Loading spinner for submit button */
.submit-btn.loading {
    position: relative;
    pointer-events: none;
}

.submit-btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    margin: auto;
    border: 2px solid transparent;
    border-top-color: var(--btn-text);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}