/* login.css - Optimized Login Interface with Full Width Buttons */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Mitr', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding: 0;
    margin: 0;
}

/* Modern background with blur */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        linear-gradient(135deg, rgba(var(--primary-rgb), 0.25) 0%, transparent 60%),
        url('https://images.unsplash.com/photo-1563013544-824ae1b704d3?ixlib=rb-4.0.3&auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    z-index: -2;
    filter: blur(6px) brightness(1.05);
}

/* Dark mode */
body.active::before {
    filter: blur(6px) brightness(0.6) contrast(1.1);
}

body.active::after {
    background: rgba(0, 0, 0, 0.7);
}

/* Language Switcher */
.language-switcher {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.language-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
}

.language-btn:hover {
    border-color: var(--primary);
}

.language-btn i:first-child {
    color: var(--primary);
    font-size: 14px;
}

.language-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    display: none;
    z-index: 1001;
}

.language-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid var(--border-light);
}

.language-option:last-child {
    border-bottom: none;
}

.language-option:hover {
    background: var(--primary-light);
}

.language-option.active {
    background: var(--primary-light);
    color: var(--primary);
}

.language-flag {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

/* Login Container */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    background: var(--surface);
    border-radius: 18px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    padding: 35px;
    position: relative;
    overflow: hidden;
}

/* Header */
.login-header {
    text-align: center;
    margin-bottom: 25px;
}

.logo-container {
    margin-bottom: 20px;
}

.header-content h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.header-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Form Elements */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.section-label i {
    color: var(--primary);
    width: 18px;
    text-align: center;
    font-size: 14px;
}

.required {
    color: var(--error);
    font-size: 14px;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    font-size: 14px;
    z-index: 1;
}

.form-input {
    width: 100%;
    height: 48px;
    padding: 0 14px 0 42px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--surface);
    transition: all 0.3s ease;
    outline: none;
    font-family: inherit;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.form-input::placeholder {
    color: var(--text-tertiary);
    font-size: 14px;
}

/* Password Input */
.password-input {
    padding-right: 46px;
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

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

/* Checkbox */
.remember-me {
    margin-top: 5px;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--text-primary);
}

.checkbox-container input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-container input:checked ~ .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}

.checkmark::after {
    content: '';
    position: absolute;
    display: none;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-container input:checked ~ .checkmark::after {
    display: block;
}

/* Full Width Login Button */
.submit-btn {
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, var(--primary) 0%, rgba(var(--primary-rgb), 0.9) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    margin-top: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.25);
    position: relative;
    overflow: hidden;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.35);
}

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

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.submit-btn::after {
    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.7s ease;
}

.submit-btn:hover::after {
    left: 100%;
}

/* Full Width PIN Button */
.pin-submit-btn {
    width: 100%;
    height: 52px;
    background: linear-gradient(135deg, var(--primary) 0%, rgba(var(--primary-rgb), 0.9) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    transition: all 0.3s ease;
    margin-top: 15px;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.25);
}

.pin-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.35);
}

.pin-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Links */
.forgot-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}

.forgot-link:hover {
    text-decoration: underline;
}

.signup-link {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-secondary);
}

.signup-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 8px;
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.signup-btn:hover {
    text-decoration: underline;
}

.signup-btn i {
    font-size: 13px;
}

/* PIN Login Styles */
.pin-login {
    width: 100%;
}

.method-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    width: 100%;
}

.method-header i {
    font-size: 32px;
    color: var(--primary);
}

.user-info {
    flex: 1;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.user-email {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 400;
}

.logout-other-btn {
    background: rgba(240, 68, 56, 0.1);
    border: 1px solid rgba(240, 68, 56, 0.2);
    color: var(--error);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-other-btn:hover {
    background: rgba(240, 68, 56, 0.2);
    transform: scale(1.05);
}

.pin-input-container {
    width: 100%;
    margin-bottom: 20px;
}

.pin-input-wrapper {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 15px;
    width: 100%;
}

.pin-digit {
    width: 55px;
    height: 55px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface);
    transition: all 0.2s;
}

.pin-digit:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
    outline: none;
}

.pin-timeout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: var(--primary-light);
    border-radius: var(--radius-md);
    color: var(--warning);
    font-size: 14px;
    font-weight: 500;
    width: 100%;
}

.pin-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 15px;
}

.pin-footer a {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color 0.2s;
}

.pin-footer a:hover {
    text-decoration: underline;
}

/* Label Row for Password */
.label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    width: 100%;
}

/* PIN Attempts Warning */
.pin-attempts-warning {
    background: linear-gradient(135deg, #fef3f2 0%, #fff6ed 100%);
    border: 1px solid #fecdca;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideDown 0.3s ease;
    width: 100%;
}

.pin-attempts-warning i {
    color: var(--warning);
    font-size: 18px;
}

.pin-attempts-warning .warning-content {
    flex: 1;
}

.pin-attempts-warning .warning-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    font-size: 14px;
}

.pin-attempts-warning .warning-message {
    font-size: 13px;
    color: var(--text-secondary);
}

.pin-attempts-warning.error {
    background: linear-gradient(135deg, #fef3f2 0%, #fef3f2 100%);
    border-color: var(--error);
}

.pin-attempts-warning.error i {
    color: var(--error);
}

.attempts-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: var(--error);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 600;
    margin: 0 4px;
}

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

.shake {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.digit-error {
    border-color: var(--error) !important;
    background-color: rgba(240, 68, 56, 0.05) !important;
}

/* Toast Notification - Top Right */
.toast {
    position: fixed;
    top: 20px;
    right: -400px;
    max-width: 350px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 14px 16px;
    transition: right 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    z-index: 1002;
    border-left: 4px solid var(--primary);
    overflow: hidden;
}

.toast.show {
    right: 20px;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast.info {
    border-left-color: var(--info);
}

.toast-content {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.toast-icon {
    font-size: 18px;
    color: var(--primary);
    margin-top: 1px;
    flex-shrink: 0;
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error .toast-icon {
    color: var(--error);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info .toast-icon {
    color: var(--info);
}

.toast-text {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
    font-size: 14px;
}

.toast-message {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1003;
    backdrop-filter: blur(3px);
}

.loading-overlay.show {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.loader {
    text-align: center;
    background: var(--surface);
    padding: 25px;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    max-width: 250px;
    width: 90%;
}

.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

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

.loader-text {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .login-wrapper {
        padding: 15px;
        padding-top: 70px;
    }
    
    .language-switcher {
        top: 15px;
        right: 15px;
    }
    
    .login-container {
        padding: 30px 25px;
        max-width: 400px;
        border-radius: 16px;
    }
    
    .logo-circle {
        width: 75px;
        height: 75px;
        margin-bottom: 18px;
    }
    
    .logo {
        height: 48px;
    }
    
    .header-content h1 {
        font-size: 22px;
    }
    
    .header-content p {
        font-size: 13px;
    }
    
    .login-form {
        gap: 18px;
    }
    
    .form-input {
        height: 46px;
        font-size: 14px;
    }
    
    .submit-btn,
    .pin-submit-btn {
        height: 50px;
        font-size: 15px;
        margin-top: 12px;
        margin-bottom: 12px;
    }
    
    .toast {
        max-width: 320px;
        top: 15px;
        right: -350px;
        padding: 12px 14px;
    }
    
    .toast.show {
        right: 15px;
    }
    
    .pin-digit {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .pin-footer {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }
    
    .pin-footer a {
        text-align: center;
        width: 100%;
    }
}

@media (max-width: 480px) {
    .login-wrapper {
        padding: 12px;
        padding-top: 65px;
    }
    
    .login-container {
        padding: 28px 22px;
        max-width: 360px;
        border-radius: 14px;
    }
    
    .logo-circle {
        width: 70px;
        height: 70px;
    }
    
    .logo {
        height: 45px;
    }
    
    .header-content h1 {
        font-size: 20px;
    }
    
    .form-input {
        height: 46px;
        padding: 0 12px 0 40px;
    }
    
    .input-icon {
        left: 12px;
    }
    
    .password-toggle {
        right: 12px;
    }
    
    .submit-btn,
    .pin-submit-btn {
        height: 48px;
        font-size: 14px;
    }
    
    .signup-link {
        margin-top: 22px;
        padding-top: 18px;
        font-size: 13px;
    }
    
    .pin-digit {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }
    
    .method-header {
        padding: 14px;
    }
    
    .method-header i {
        font-size: 28px;
    }
    
    .user-name {
        font-size: 14px;
    }
    
    .user-email {
        font-size: 12px;
    }
}

/* Dark Mode */
body.active .login-container {
    background: rgba(30, 30, 30, 0.95);
    border-color: hsl(0, 0%, 30%);
}

body.active .form-input {
    background: hsl(0, 0%, 20%);
    border-color: hsl(0, 0%, 35%);
    color: hsl(0, 0%, 95%);
}

body.active .form-input:focus {
    border-color: var(--primary);
}

body.active .language-btn {
    background: rgba(30, 30, 30, 0.9);
    border-color: hsl(0, 0%, 35%);
    color: hsl(0, 0%, 95%);
}

body.active .language-dropdown {
    background: hsl(0, 0%, 25%);
    border-color: hsl(0, 0%, 35%);
}

body.active .language-option {
    color: hsl(0, 0%, 95%);
    border-color: hsl(0, 0%, 35%);
}

body.active .toast {
    background: hsl(0, 0%, 25%);
    color: hsl(0, 0%, 95%);
}

body.active .toast-title {
    color: hsl(0, 0%, 95%);
}

body.active .toast-message {
    color: hsl(0, 0%, 80%);
}

body.active .pin-digit {
    background: hsl(0, 0%, 20%);
    border-color: hsl(0, 0%, 35%);
    color: hsl(0, 0%, 95%);
}

body.active .pin-attempts-warning {
    background: hsl(0, 0%, 20%);
    border-color: hsl(0, 0%, 35%);
    color: hsl(0, 0%, 95%);
}

body.active .pin-attempts-warning .warning-title {
    color: hsl(0, 0%, 95%);
}

body.active .pin-attempts-warning .warning-message {
    color: hsl(0, 0%, 80%);
}

body.active .method-header {
    background: hsl(0, 0%, 25%);
    border-color: hsl(0, 0%, 35%);
}

body.active .pin-timeout {
    background: hsl(0, 0%, 25%);
    color: hsl(0, 0%, 95%);
}

body.active .submit-btn,
body.active .pin-submit-btn {
    background: linear-gradient(135deg, var(--primary) 0%, rgba(var(--primary-rgb), 0.8) 100%);
}

/* Animation for button hover */
@keyframes buttonGlow {
    0% {
        box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.25);
    }
    50% {
        box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.4);
    }
    100% {
        box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.25);
    }
}

.submit-btn:hover,
.pin-submit-btn:hover:not(:disabled) {
    animation: buttonGlow 1.5s infinite;
}

/* Loading state for buttons */
.submit-btn.loading,
.pin-submit-btn.loading {
    position: relative;
    color: transparent;
}

.submit-btn.loading::before,
.pin-submit-btn.loading::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid white;
    border-radius: 50%;
    border-top-color: transparent;
    animation: buttonSpin 1s linear infinite;
}

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