/* CSS Variables for theming */
:root {
    --primary-green: #007953;
    --primary-green-light: #009966;
    --primary-green-dark: #005940;
    --background-gradient-start: #007953;
    --background-gradient-end: #00a065;
    --white: #ffffff;
    --text-gray: #666666;
    --text-placeholder: #999999;
    --error-red: #dc3545;
    --error-bg: #f8d7da;
    --shadow-light: rgba(0, 0, 0, 0.1);
    --shadow-medium: rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --border-radius-small: 8px;
    --transition: all 0.3s ease;
    --font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    height: 100%;
    font-size: 16px;
}

body {
    height: 100vh;
    font-family: var(--font-family);
    background: linear-gradient(135deg, var(--background-gradient-start) 0%, var(--background-gradient-end) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 0;
    overflow-x: hidden;
}

/* Container */
.container {
    width: 100%;
    max-width: 400px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
}

.title {
    color: var(--white);
    font-size: 2.2rem;
    font-weight: 400;
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
}

/* Logo container */
.logo-container {
    width: 100%;
    max-width: 300px;
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    width: 100%;
    height: auto;
    max-width: 280px;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px var(--shadow-medium);
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 16px var(--shadow-medium);
}

/* Login section */
.login-section {
    width: 100%;
    max-width: 350px;
}

.login-form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: 30px 25px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Input groups */
.input-group {
    margin-bottom: 20px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 15px;
    color: var(--text-gray);
    font-size: 1.1rem;
    z-index: 2;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 16px 20px 16px 50px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius-small);
    font-size: 1rem;
    font-family: var(--font-family);
    background: var(--white);
    transition: var(--transition);
    outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(0, 121, 83, 0.1);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: var(--text-placeholder);
    font-weight: 400;
}

/* Password toggle */
.password-toggle {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-gray);
    cursor: pointer;
    padding: 5px;
    font-size: 1rem;
    transition: var(--transition);
    z-index: 2;
}

.password-toggle:hover {
    color: var(--primary-green);
}

/* Error message */
.error-message {
    background: var(--error-bg);
    color: var(--error-red);
    padding: 12px 15px;
    border-radius: var(--border-radius-small);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(220, 53, 69, 0.3);
    animation: slideInDown 0.3s ease;
}

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

/* Login button */
.login-button {
    width: 100%;
    background: var(--primary-green);
    color: var(--white);
    border: none;
    padding: 16px 20px;
    border-radius: var(--border-radius-small);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-family);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 121, 83, 0.3);
}

.login-button:hover {
    background: var(--primary-green-light);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 121, 83, 0.4);
}

.login-button:active {
    transform: translateY(0);
}

.login-button:disabled {
    background: var(--text-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--transition);
}

.button-icon {
    font-size: 1.1rem;
}

.button-text {
    font-weight: 600;
}

/* Loading spinner */
.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

.login-button.loading .button-content {
    opacity: 0;
}

.login-button.loading .loading-spinner {
    display: block;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid var(--white);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 480px) {
    body {
        padding: 15px;
    }
    
    .container {
        padding: 15px;
        min-height: 100vh;
    }
    
    .title {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    .logo-container {
        max-width: 250px;
        margin-bottom: 30px;
    }
    
    .logo {
        max-width: 240px;
        max-height: 170px;
    }
    
    .login-form {
        padding: 25px 20px;
    }
    
    input[type="text"],
    input[type="password"] {
        padding: 14px 18px 14px 45px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .login-button {
        padding: 14px 18px;
        font-size: 1rem;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 10px;
    }
    
    .title {
        font-size: 1.6rem;
    }
    
    .logo-container {
        max-width: 220px;
        margin-bottom: 25px;
    }
    
    .logo {
        max-width: 210px;
        max-height: 150px;
    }
    
    .login-form {
        padding: 20px 15px;
    }
}

/* Landscape orientation for mobile */
@media (max-height: 600px) and (orientation: landscape) {
    .container {
        min-height: auto;
        justify-content: flex-start;
        padding-top: 20px;
    }
    
    .title {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .logo-container {
        margin-bottom: 20px;
        max-width: 200px;
    }
    
    .logo {
        max-height: 120px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .login-form {
        background: rgba(255, 255, 255, 0.98);
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for accessibility */
input:focus,
button:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .login-form {
        border: 2px solid #000;
    }
    
    input[type="text"],
    input[type="password"] {
        border-width: 2px;
    }
}
