* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a1628;
    --bg-secondary: #1a2d4a;
    --bg-card: rgba(17, 29, 46, 0.95);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --border-color: rgba(255, 255, 255, 0.1);
    --input-bg: rgba(255, 255, 255, 0.05);
    --primary-color: #34c759;
    --primary-hover: #28a745;
}

[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --bg-secondary: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-primary: #1a202c;
    --text-secondary: rgba(26, 32, 44, 0.7);
    --text-muted: rgba(26, 32, 44, 0.4);
    --border-color: rgba(0, 0, 0, 0.1);
    --input-bg: rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-primary) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    transition: background 0.3s ease;
}

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 1000;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* Animated background elements */
.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.bg-animation .circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(52, 199, 89, 0.1);
    animation: float 15s infinite ease-in-out;
}

[data-theme="light"] .bg-animation .circle {
    background: rgba(52, 199, 89, 0.15);
}

.bg-animation .circle:nth-child(1) {
    width: 300px;
    height: 300px;
    top: -150px;
    left: -100px;
    animation-delay: 0s;
}

.bg-animation .circle:nth-child(2) {
    width: 200px;
    height: 200px;
    bottom: -100px;
    right: -50px;
    animation-delay: 2s;
}

.bg-animation .circle:nth-child(3) {
    width: 150px;
    height: 150px;
    top: 50%;
    right: 10%;
    animation-delay: 4s;
}

.bg-animation .circle:nth-child(4) {
    width: 100px;
    height: 100px;
    bottom: 20%;
    left: 15%;
    animation-delay: 6s;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) rotate(180deg);
    }
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 1100px;
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5),
                0 0 0 1px rgba(255, 255, 255, 0.05);
    margin: 20px;
}

.login-left {
    flex: 1;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(135deg, rgba(224, 224, 224, 0.15) 0%, rgba(219, 228, 221, 0.096) 100%);
    position: relative;
}

.login-left::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, rgba(171, 187, 175, 0.3), transparent);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
}

.brand-logo .logo-img {
    width: auto;
}

.brand-logo .logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #34c759 0%, #28a745 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 30px rgba(52, 199, 89, 0.3);
    flex-shrink: 0;
}

.brand-logo .logo-icon i {
    font-size: 24px;
    color: white;
}

.brand-logo span {
    font-size: 24px;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.welcome-text h1 {
    font-size: 42px;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
    line-height: 1.2;
}

.welcome-text h1 span {
    color: #34c759;
}

.welcome-text p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

.login-right {
    flex: 1;
    padding: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-form-header {
    margin-bottom: 32px;
}

.login-form-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: white;
    margin-bottom: 8px;
}

.login-form-header p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group.half {
    flex: 1;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
}

.login-link {
    text-align: center;
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.login-link a {
    color: #34c759;
    text-decoration: none;
    font-weight: 500;
}

.login-link a:hover {
    text-decoration: underline;
}

.input-wrapper {
    position: relative;
}

.input-wrapper > i {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 16px 50px 16px 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 16px;
    color: white;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    -webkit-appearance: none;
    appearance: none;
}

.input-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.input-wrapper input:focus {
    outline: none;
    border-color: #34c759;
    background: rgba(52, 199, 89, 0.05);
    box-shadow: 0 0 0 4px rgba(52, 199, 89, 0.1);
}

.input-wrapper input:focus ~ i {
    color: #34c759;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 2;
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

.password-toggle i {
    position: static;
    transform: none;
    pointer-events: none;
}

.password-toggle:hover,
.password-toggle:focus {
    color: #34c759;
    outline: none;
}

/* Remember Me Checkbox */
.remember-me {
    margin-bottom: 24px;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.checkbox-wrapper input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    height: 20px;
    width: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkbox-wrapper:hover .checkmark {
    border-color: #34c759;
}

.checkbox-wrapper input[type="checkbox"]:checked ~ .checkmark {
    background: #34c759;
    border-color: #34c759;
}

.checkmark::after {
    content: '';
    display: none;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.checkbox-wrapper input[type="checkbox"]:checked ~ .checkmark::after {
    display: block;
}

.label-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #34c759 0%, #28a745 100%);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(52, 199, 89, 0.4);
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:active {
    transform: translateY(0);
}

/* Divider */
.divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
}

.divider span {
    padding: 0 16px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 13px;
    white-space: nowrap;
}

/* Google Button */
.google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.google-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.google-btn svg {
    flex-shrink: 0;
}

/* Register Link */
.register-link {
    text-align: center;
    margin-top: 24px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 14px;
}

.register-link a {
    color: #34c759;
    text-decoration: none;
    font-weight: 500;
}

.register-link a:hover {
    text-decoration: underline;
}

/* Error Messages */
.error-message {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    color: #ff6b6b;
    font-size: 13px;
    display: none;
    align-items: center;
    gap: 10px;
}

.error-message i {
    flex-shrink: 0;
    font-size: 16px;
}

.error-message.show {
    display: flex;
}

/* Loading State */
.login-btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.login-btn.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== RESPONSIVE DESIGN ==================== */

/* Large tablets and small desktops */
@media (max-width: 1024px) {
    .login-container {
        max-width: 900px;
    }

    .login-left,
    .login-right {
        padding: 50px;
    }

    .welcome-text h1 {
        font-size: 36px;
    }
}

/* Tablets */
@media (max-width: 900px) {
    .login-container {
        flex-direction: column;
        max-width: 500px;
    }

    .login-left {
        padding: 40px;
    }

    .login-left::before {
        width: 100%;
        height: 1px;
        top: auto;
        bottom: 0;
        background: linear-gradient(to right, transparent, rgba(52, 199, 89, 0.3), transparent);
    }

    .welcome-text h1 {
        font-size: 32px;
    }

    .login-right {
        padding: 40px;
    }
}

/* Large phones */
@media (max-width: 600px) {
    body {
        padding: 10px;
    }

    .login-container {
        margin: 10px;
        border-radius: 20px;
    }

    .login-left,
    .login-right {
        padding: 30px 25px;
    }

    .brand-logo {
        margin-bottom: 24px;
    }

    .brand-logo .logo-icon {
        width: 44px;
        height: 44px;
    }

    .brand-logo .logo-icon i {
        font-size: 20px;
    }

    .brand-logo span {
        font-size: 20px;
    }

    .welcome-text h1 {
        font-size: 26px;
        margin-bottom: 12px;
    }

    .welcome-text p {
        font-size: 14px;
    }

    .login-form-header {
        margin-bottom: 24px;
    }

    .login-form-header h2 {
        font-size: 24px;
    }

    .login-form-header p {
        font-size: 13px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .input-wrapper input {
        padding: 14px 45px 14px 44px;
        font-size: 16px;
    }

    .input-wrapper > i {
        left: 14px;
    }

    .password-toggle {
        right: 10px;
    }

    .login-btn {
        padding: 14px;
        font-size: 15px;
    }
}

/* Small phones */
@media (max-width: 400px) {
    .login-container {
        margin: 5px;
        border-radius: 16px;
    }

    .login-left,
    .login-right {
        padding: 24px 20px;
    }

    .brand-logo {
        margin-bottom: 20px;
        gap: 10px;
    }

    .brand-logo .logo-icon {
        width: 40px;
        height: 40px;
    }

    .brand-logo .logo-icon i {
        font-size: 18px;
    }

    .brand-logo span {
        font-size: 18px;
    }

    .welcome-text h1 {
        font-size: 22px;
    }

    .welcome-text p {
        font-size: 13px;
    }

    .login-form-header h2 {
        font-size: 22px;
    }

    .form-group label {
        font-size: 12px;
    }

    .input-wrapper input {
        padding: 12px 42px 12px 40px;
        border-radius: 10px;
    }

    .input-wrapper > i {
        left: 12px;
        font-size: 14px;
    }

    .password-toggle {
        right: 8px;
        padding: 6px;
    }

    .login-btn {
        padding: 13px;
        border-radius: 10px;
    }

    .bg-animation .circle:nth-child(1) {
        width: 200px;
        height: 200px;
    }

    .bg-animation .circle:nth-child(2) {
        width: 150px;
        height: 150px;
    }

    .bg-animation .circle:nth-child(3) {
        width: 100px;
        height: 100px;
    }

    .bg-animation .circle:nth-child(4) {
        width: 80px;
        height: 80px;
    }
}

/* Extra small phones */
@media (max-width: 320px) {
    .login-left,
    .login-right {
        padding: 20px 16px;
    }

    .welcome-text h1 {
        font-size: 20px;
    }

    .login-form-header h2 {
        font-size: 20px;
    }
}

/* Landscape orientation on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        align-items: flex-start;
        padding: 10px;
    }

    .login-container {
        flex-direction: row;
        max-width: 100%;
        margin: 10px;
    }

    .login-left,
    .login-right {
        padding: 25px;
    }

    .brand-logo {
        margin-bottom: 15px;
    }

    .welcome-text h1 {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .welcome-text p {
        font-size: 12px;
    }

    .login-form-header {
        margin-bottom: 15px;
    }

    .login-form-header h2 {
        font-size: 20px;
        margin-bottom: 4px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .input-wrapper input {
        padding: 10px 42px 10px 40px;
    }

    .login-btn {
        padding: 10px;
    }
}

/* High DPI / Retina displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .login-container {
        box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4),
                    0 0 0 0.5px rgba(255, 255, 255, 0.05);
    }
}

/* Hover states only for devices that support hover */
@media (hover: hover) and (pointer: fine) {
    .login-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 10px 30px rgba(52, 199, 89, 0.4);
    }

    .password-toggle:hover {
        color: #34c759;
    }
}

/* Touch devices - remove hover effects that don't work well */
@media (hover: none) {
    .login-btn:hover {
        transform: none;
    }

    .login-btn:active {
        transform: scale(0.98);
        box-shadow: 0 5px 15px rgba(52, 199, 89, 0.3);
    }
}

/* ==================== LIGHT THEME OVERRIDES ==================== */
[data-theme="light"] .login-container {
    background: var(--bg-card);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15),
                0 0 0 1px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .login-left {
    background: linear-gradient(135deg, rgba(52, 199, 89, 0.1) 0%, rgba(52, 199, 89, 0.05) 100%);
}

[data-theme="light"] .login-left::before {
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1), transparent);
}

[data-theme="light"] .brand-logo span,
[data-theme="light"] .welcome-text h1 {
    color: var(--text-primary);
}

[data-theme="light"] .welcome-text p {
    color: var(--text-secondary);
}

[data-theme="light"] .login-form-header h2 {
    color: var(--text-primary);
}

[data-theme="light"] .login-form-header p {
    color: var(--text-secondary);
}

[data-theme="light"] .form-group label {
    color: var(--text-secondary);
}

[data-theme="light"] .input-wrapper input {
    background: var(--input-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="light"] .input-wrapper input::placeholder {
    color: var(--text-muted);
}

[data-theme="light"] .input-wrapper > i {
    color: var(--text-muted);
}

[data-theme="light"] .password-toggle {
    color: var(--text-muted);
}

[data-theme="light"] .checkmark {
    background: var(--input-bg);
    border-color: var(--border-color);
}

[data-theme="light"] .label-text {
    color: var(--text-secondary);
}

[data-theme="light"] .divider span {
    background: var(--bg-card);
    color: var(--text-muted);
}

[data-theme="light"] .divider::before,
[data-theme="light"] .divider::after {
    background: var(--border-color);
}

[data-theme="light"] .google-btn {
    background: var(--input-bg);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="light"] .google-btn:hover {
    background: var(--bg-secondary);
}

[data-theme="light"] .register-link,
[data-theme="light"] .login-link {
    color: var(--text-secondary);
}

[data-theme="light"] .error-message {
    background: rgba(220, 53, 69, 0.1);
    border-color: rgba(220, 53, 69, 0.2);
}
