:root {
    --primary-color: #1a73e8;
    --accent-color: #34a853;
    --text-color: #1e293b;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --bg-light: #f5f7fa;
    --bg-dark: #1e293b;
    --text-dark: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    position: relative;
    overflow-x: hidden;
    transition: background 0.3s ease;
}

body.dark-mode {
    background: var(--bg-dark);
    color: var(--text-dark);
}

/* Dynamic SVG Background */
.background-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
    animation: flow 20s infinite linear;
}

@keyframes flow {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    position: relative;
}

.card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: none;
    animation: slideUp 0.6s ease-out;
}

body.dark-mode .card {
    background: #2d3748;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-header {
    background: var(--primary-color);
    color: white;
    padding: 20px;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
}

.card-header h5 {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.card-header i {
    margin-left: 8px;
    font-size: 18px;
}

.card-body {
    padding: 40px 30px;
    animation: fadeIn 1s ease-out;
}

.logo-container {
    margin-bottom: 20px;
    text-align: center;
    animation: fadeIn 1.2s ease-out;
}

.logo-container img {
    max-width: 120px;
    height: auto;
}

.welcome-message {
    color: var(--text-color);
    font-size: 16px;
    margin-top: 10px;
    text-align: center;
    animation: fadeIn 1.4s ease-out;
}

body.dark-mode .welcome-message {
    color: var(--text-dark);
}

h3 {
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 30px;
    text-align: center;
    animation: fadeIn 1.6s ease-out;
}

body.dark-mode h3 {
    color: var(--text-dark);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Floating Label Inputs */
.form-group {
    margin-bottom: 25px;
    position: relative;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    z-index: 1;
}

.form-control {
    width: 100%;
    padding: 20px 16px 8px 40px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    background: transparent;
    position: relative;
    z-index: 1;
    transition: border-color 0.3s ease;
}

body.dark-mode .form-control {
    border-color: #4b5563;
    color: var(--text-dark);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-label {
    position: absolute;
    left: 40px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 14px;
    pointer-events: none;
    transition: all 0.2s ease;
    z-index: 0;
}

.form-control:focus + .form-label,
.form-control:not(:placeholder-shown) + .form-label {
    top: 10px;
    font-size: 12px;
    color: var(--primary-color);
    transform: translateY(0);
}

/* Checkbox and 2FA */
.checkbox-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    color: #64748b;
    font-size: 14px;
    transition: transform 0.2s ease;
}

body.dark-mode .checkbox-container {
    color: #b0b7c3;
}

.checkbox-container:hover {
    transform: scale(1.02);
}

.tooltip {
    position: relative;
    margin-left: 8px;
    cursor: pointer;
}

.tooltip::after {
    content: "Enhance security with a second verification step";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Enhanced Button */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--primary-color), #1557b0);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    box-shadow: 0 6px 12px -2px rgba(26, 115, 232, 0.3);
    transform: translateY(-2px);
}

.btn-primary::after {
    content: '';
    position: absolute;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: scale(0);
    pointer-events: none;
    animation: ripple 0.6s ease-out;
    top: var(--y);
    left: var(--x);
}

@keyframes ripple {
    to { transform: scale(4); opacity: 0; }
}

.btn-spinner {
    display: none;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    border: 3px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 0.8s ease-in-out infinite;
}

@keyframes spin {
    to { transform: translateY(-50%) rotate(360deg); }
}

.btn-primary.loading .btn-text {
    opacity: 0;
}

.btn-primary.loading .btn-spinner {
    display: block;
}

/* Forgot Password and Footer */
.forgot-password {
    text-align: center;
    margin-top: 20px;
}

.forgot-password a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease;
}

.forgot-password a:hover {
    text-decoration: underline;
}

.card-footer {
    text-align: center;
    padding: 15px;
    font-size: 12px;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
}

body.dark-mode .card-footer {
    color: #b0b7c3;
    border-top-color: #4b5563;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    background: #e2e8f0;
    transition: background 0.3s ease;
}

body.dark-mode .dark-mode-toggle {
    background: #4b5563;
}

/* Alerts with Animation */
.alert {
    border-radius: 8px;
    margin-bottom: 20px;
    padding: 15px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* Accessibility */
.form-control:focus,
.btn-primary:focus,
.forgot-password a:focus,
.dark-mode-toggle:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}