/**
 * Login Page Styles
 * Lean, Sleek, Modern Design
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;
    --success: #10B981;
    --danger: #EF4444;
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

/* Animated background elements */
body::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -250px;
    right: -250px;
    animation: float 20s ease-in-out infinite;
}

body::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 50%;
    bottom: -200px;
    left: -200px;
    animation: float 15s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

.login-container {
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-card {
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 28px 28px 36px;
    text-align: center;
    position: relative;
}

.login-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: white;
    border-radius: 20px 20px 0 0;
}

.logo-container {
    width: 56px;
    height: 56px;
    background: white;
    border-radius: 14px;
    margin: 0 auto 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    animation: bounce 0.8s ease-out 0.3s;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.logo-container i {
    font-size: 26px;
    color: var(--primary);
}

.login-title {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: white;
    margin-bottom: 5px;
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
    font-weight: 500;
}

.login-body {
    padding: 24px 28px;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 16px;
    transition: color 0.3s;
}

.form-control {
    width: 100%;
    padding: 12px 14px 12px 44px;
    border: 2px solid var(--gray-200);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
    transition: all 0.3s;
    background: var(--gray-50);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.form-control:focus + .input-icon {
    color: var(--primary);
}

.form-control::placeholder {
    color: var(--gray-400);
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
    transition: color 0.3s;
}

.password-toggle:hover {
    color: var(--gray-600);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-login::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;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}

.btn-login:hover::before {
    left: 100%;
}

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

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-login .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-login.loading .btn-text {
    display: none;
}

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

.alert {
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 12px;
    font-weight: 500;
    display: none;
    animation: slideDown 0.3s ease-out;
}

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

.alert-danger {
    background: #FEE2E2;
    color: #991B1B;
    border: 1px solid #FCA5A5;
}

.alert-success {
    background: #D1FAE5;
    color: #065F46;
    border: 1px solid #6EE7B7;
}

.alert i {
    margin-right: 8px;
}

.login-footer {
    text-align: center;
    padding: 16px 28px 28px;
    color: var(--gray-500);
    font-size: 11px;
}

.test-accounts {
    background: var(--gray-50);
    border-radius: 8px;
    padding: 12px;
    margin-top: 14px;
}

.test-accounts-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.test-account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 9px;
    background: white;
    border-radius: 6px;
    margin-bottom: 5px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--gray-200);
}

.test-account:last-child {
    margin-bottom: 0;
}

.test-account:hover {
    border-color: var(--primary);
    transform: translateX(4px);
}

.test-account-info {
    flex: 1;
}

.test-account-role {
    font-size: 10px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 2px;
}

.test-account-email {
    font-size: 9px;
    color: var(--gray-500);
}

.test-account-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-danger { background: #FEE2E2; color: #991B1B; }
.badge-primary { background: #DBEAFE; color: #1E40AF; }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-info { background: #DBEAFE; color: #075985; }
.badge-secondary { background: #F3F4F6; color: #4B5563; }

/* ===== RESPONSIVE DESIGN ===== */

/* Large Desktop (1920px+) - Extra comfortable spacing */
@media (min-width: 1920px) {
    body {
        padding: 40px;
    }
    
    .login-container {
        max-width: 420px;
    }
    
    body::before {
        width: 600px;
        height: 600px;
        top: -300px;
        right: -300px;
    }
    
    body::after {
        width: 500px;
        height: 500px;
        bottom: -250px;
        left: -250px;
    }
}

/* Desktop (1024px - 1919px) - Standard comfortable view */
@media (min-width: 1024px) and (max-width: 1919px) {
    body {
        padding: 30px;
    }
    
    .login-container {
        max-width: 400px;
    }
}

/* Tablet Landscape (768px - 1023px) - Optimized for tablets */
@media (min-width: 768px) and (max-width: 1023px) {
    body {
        padding: 24px;
    }
    
    .login-container {
        max-width: 420px;
    }
    
    .login-header {
        padding: 28px 28px 36px;
    }
    
    .login-body {
        padding: 24px 28px;
    }
    
    .test-accounts {
        display: block;
    }
}

/* Tablet Portrait (600px - 767px) - Compact tablet view */
@media (min-width: 600px) and (max-width: 767px) {
    body {
        padding: 20px;
    }
    
    .login-container {
        max-width: 380px;
    }
    
    .login-header {
        padding: 26px 26px 34px;
    }
    
    .login-body {
        padding: 22px 26px;
    }
    
    .login-title {
        font-size: 21px;
    }
    
    .test-accounts {
        display: block;
    }
}

/* Large Phone (481px - 599px) - Large smartphones */
@media (min-width: 481px) and (max-width: 599px) {
    body {
        padding: 16px;
    }
    
    .login-container {
        max-width: 100%;
    }
    
    .login-header {
        padding: 24px 24px 32px;
    }
    
    .login-body {
        padding: 20px 24px;
    }
    
    .login-footer {
        padding: 16px 24px 24px;
    }
    
    .login-title {
        font-size: 20px;
    }
    
    .logo-container {
        width: 54px;
        height: 54px;
    }
    
    .logo-container i {
        font-size: 25px;
    }
    
    .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .test-accounts {
        display: none;
    }
}

/* Standard Phone (376px - 480px) - Most smartphones */
@media (min-width: 376px) and (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .login-container {
        max-width: 100%;
    }
    
    .login-header {
        padding: 24px 20px 32px;
    }
    
    .login-body {
        padding: 20px 24px;
    }
    
    .login-footer {
        padding: 14px 24px 24px;
    }
    
    .login-title {
        font-size: 20px;
    }
    
    .logo-container {
        width: 52px;
        height: 52px;
    }
    
    .logo-container i {
        font-size: 24px;
    }
    
    .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 12px 14px 12px 42px;
    }
    
    .input-icon {
        left: 12px;
        font-size: 15px;
    }
    
    .password-toggle {
        right: 12px;
        font-size: 15px;
    }
    
    .btn-login {
        padding: 13px;
        font-size: 14px;
    }
    
    .test-accounts {
        display: none;
    }
}

/* Small Phone (320px - 375px) - Compact smartphones */
@media (max-width: 375px) {
    body {
        padding: 10px;
    }
    
    .login-container {
        max-width: 100%;
    }
    
    .login-card {
        border-radius: 16px;
    }
    
    .login-header {
        padding: 20px 18px 28px;
    }
    
    .login-header::after {
        height: 16px;
        border-radius: 16px 16px 0 0;
    }
    
    .login-body {
        padding: 18px 20px;
    }
    
    .login-footer {
        padding: 12px 20px 20px;
    }
    
    .login-title {
        font-size: 19px;
    }
    
    .login-subtitle {
        font-size: 11px;
    }
    
    .logo-container {
        width: 50px;
        height: 50px;
        border-radius: 12px;
        margin-bottom: 12px;
    }
    
    .logo-container i {
        font-size: 23px;
    }
    
    .form-group {
        margin-bottom: 14px;
    }
    
    .form-label {
        font-size: 12px;
        margin-bottom: 5px;
    }
    
    .form-control {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 11px 12px 11px 40px;
        border-radius: 8px;
    }
    
    .input-icon {
        left: 11px;
        font-size: 14px;
    }
    
    .password-toggle {
        right: 11px;
        font-size: 14px;
    }
    
    .btn-login {
        padding: 12px;
        font-size: 14px;
        border-radius: 8px;
    }
    
    .alert {
        padding: 9px 11px;
        font-size: 11px;
        margin-bottom: 14px;
    }
    
    .test-accounts {
        display: none;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .form-control,
    .btn-login,
    .password-toggle,
    .test-account {
        /* Larger touch targets for mobile */
        min-height: 44px;
    }
    
    .password-toggle {
        padding: 8px;
    }
    
    /* Disable hover effects on touch devices */
    .btn-login:hover {
        transform: none;
    }
    
    .test-account:hover {
        transform: none;
    }
}

/* Landscape Orientation - Optimize vertical space */
@media (max-height: 600px) and (orientation: landscape) {
    body {
        padding: 10px;
    }
    
    .login-header {
        padding: 16px 24px 24px;
    }
    
    .login-body {
        padding: 16px 24px;
    }
    
    .login-footer {
        padding: 12px 24px 16px;
    }
    
    .logo-container {
        width: 48px;
        height: 48px;
        margin-bottom: 10px;
    }
    
    .logo-container i {
        font-size: 22px;
    }
    
    .login-title {
        font-size: 18px;
        margin-bottom: 4px;
    }
    
    .login-subtitle {
        font-size: 11px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .test-accounts {
        display: none;
    }
}

/* High DPI Displays - Sharper rendering */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .login-card {
        box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    }
    
    .logo-container {
        box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    }
}

/* Reduced Motion - Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    body::before,
    body::after {
        animation: none;
    }
}

/* Dark Mode Support - System preference */
@media (prefers-color-scheme: dark) {
    /* Optional: Add dark mode styles if needed */
    /* Currently using fixed gradient background */
}
