/* 
 * Enhanced Login Styles - สไตล์หน้าเข้าสู่ระบบที่ปรับปรุงแล้ว
 * ใช้ร่วมกับ posn_style.css
 */

/* ==============================================
   LOGIN CONTAINER - คอนเทนเนอร์หน้าเข้าสู่ระบบ
   ============================================== */

.login-container {
    min-height: 100vh;
    background: linear-gradient(135deg, #1cc88a 0%, #36b9cc 50%, #4e73df 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><radialGradient id="a" cx="50%" cy="50%"><stop offset="0%" stop-color="white" stop-opacity="0.1"/><stop offset="100%" stop-color="white" stop-opacity="0"/></radialGradient></defs><circle cx="200" cy="200" r="300" fill="url(%23a)"/><circle cx="800" cy="800" r="400" fill="url(%23a)"/></svg>') no-repeat center center;
    background-size: cover;
    opacity: 0.3;
    z-index: 0;
}

/* ==============================================
   LOGIN CARD - การ์ดเข้าสู่ระบบ
   ============================================== */

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 1;
    animation: loginCardSlideIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes loginCardSlideIn {
    0% {
        opacity: 0;
        transform: translateY(40px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==============================================
   BRAND SECTION - ส่วนแบรนด์
   ============================================== */

.brand-section {
    background: linear-gradient(135deg, #1cc88a 0%, #36b9cc 100%);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    color: white;
    padding: 3rem 2rem;
}

.brand-section::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    animation: brandShimmer 4s infinite linear;
    z-index: 1;
}

@keyframes brandShimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.brand-logo {
    width: 120px;
    height: 120px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 2;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.brand-logo i {
    font-size: 3rem;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.brand-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    z-index: 2;
}

.brand-subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
    position: relative;
    z-index: 2;
}

/* ==============================================
   LOGIN FORM - ฟอร์มเข้าสู่ระบบ
   ============================================== */

.login-form-section {
    padding: 3rem 2rem;
    position: relative;
}

.login-title {
    text-align: center;
    margin-bottom: 2rem;
    color: #2d3748;
}

.login-title h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #1cc88a 0%, #4e73df 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-title p {
    color: #6c757d;
    font-size: 0.95rem;
    margin: 0;
}

/* Form Controls Enhancement */
.form-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.form-control-enhanced {
    border: 2px solid #e3f2fd;
    border-radius: 12px;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

.form-control-enhanced:focus {
    border-color: #1cc88a;
    box-shadow: 0 0 0 0.2rem rgba(28, 200, 138, 0.15);
    background: white;
    transform: translateY(-1px);
}

.form-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1.1rem;
    z-index: 2;
    transition: color 0.3s ease;
}

.form-group.focused .form-icon {
    color: #1cc88a;
}

/* Login Button Enhancement */
.btn-login {
    width: 100%;
    padding: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    background: linear-gradient(135deg, #1cc88a 0%, #36b9cc 100%);
    border: none;
    color: white;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(28, 200, 138, 0.3);
}

.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 ease;
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:hover {
    background: linear-gradient(135deg, #13855c 0%, #258391 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 35px rgba(28, 200, 138, 0.4);
}

.btn-login:active {
    transform: translateY(0);
    box-shadow: 0 4px 15px rgba(28, 200, 138, 0.3);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.btn-login .spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.btn-login.loading .spinner {
    display: inline-block;
}

.btn-login.loading .btn-text {
    opacity: 0.8;
}

/* ==============================================
   ERROR MESSAGES - ข้อความแจ้งเตือน
   ============================================== */

.error-alert {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    border: none;
    border-left: 4px solid #dc3545;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.15);
    animation: errorSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.system-error-alert {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: none;
    border-left: 4px solid #ffc107;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.15);
    animation: errorSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes errorSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
    color: #dc3545;
}

.system-error-icon {
    font-size: 1.5rem;
    margin-right: 1rem;
    color: #ffc107;
}

.error-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #721c24;
}

.system-error-title {
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #856404;
}

.error-message {
    margin: 0;
    color: #721c24;
    line-height: 1.4;
}

.system-error-message {
    margin: 0;
    color: #856404;
    line-height: 1.4;
}

.debug-details {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #6c757d;
    word-break: break-all;
}

.debug-summary {
    cursor: pointer;
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

/* ==============================================
   UTILITIES - ยูทิลิตี้
   ============================================== */

.test-system-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #36b9cc;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(54, 185, 204, 0.1);
    border: 1px solid rgba(54, 185, 204, 0.2);
}

.test-system-link:hover {
    color: #258391;
    background: rgba(54, 185, 204, 0.15);
    border-color: rgba(54, 185, 204, 0.3);
    text-decoration: none;
    transform: translateY(-1px);
}

.test-system-link i {
    font-size: 0.8rem;
}

/* ==============================================
   RESPONSIVE DESIGN - การตอบสนองอุปกรณ์
   ============================================== */

@media (max-width: 991.98px) {
    .brand-section {
        padding: 2rem 1.5rem;
    }
    
    .brand-logo {
        width: 100px;
        height: 100px;
    }
    
    .brand-logo i {
        font-size: 2.5rem;
    }
    
    .brand-title {
        font-size: 1.5rem;
    }
    
    .brand-subtitle {
        font-size: 0.9rem;
    }
}

@media (max-width: 767.98px) {
    .login-card {
        margin: 1rem;
        border-radius: 20px;
    }
    
    .brand-section {
        padding: 2rem 1rem;
        border-radius: 20px 20px 0 0;
    }
    
    .login-form-section {
        padding: 2rem 1.5rem;
        border-radius: 0 0 20px 20px;
    }
    
    .brand-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 1rem;
    }
    
    .brand-logo i {
        font-size: 2rem;
    }
    
    .brand-title {
        font-size: 1.3rem;
    }
    
    .login-title h1 {
        font-size: 1.5rem;
    }
    
    .form-control-enhanced {
        padding: 0.875rem 0.875rem 0.875rem 2.5rem;
        font-size: 0.95rem;
    }
    
    .form-icon {
        left: 0.875rem;
        font-size: 1rem;
    }
    
    .btn-login {
        padding: 0.875rem;
        font-size: 1rem;
    }
}

@media (max-width: 575.98px) {
    .login-container {
        padding: 0.5rem;
    }
    
    .login-card {
        margin: 0.5rem;
    }
    
    .brand-section {
        padding: 1.5rem 1rem;
    }
    
    .login-form-section {
        padding: 1.5rem 1rem;
    }
    
    .brand-logo {
        width: 70px;
        height: 70px;
    }
    
    .brand-logo i {
        font-size: 1.8rem;
    }
    
    .brand-title {
        font-size: 1.2rem;
    }
    
    .brand-subtitle {
        font-size: 0.85rem;
    }
    
    .login-title h1 {
        font-size: 1.3rem;
    }
    
    .login-title p {
        font-size: 0.9rem;
    }
}

/* ==============================================
   FORM VALIDATION - การตรวจสอบฟอร์ม
   ============================================== */

.invalid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #dc3545;
    background: linear-gradient(135deg, rgba(220, 53, 69, 0.1) 0%, rgba(220, 53, 69, 0.05) 100%);
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid #dc3545;
    animation: errorSlideIn 0.3s ease;
}

.form-control-enhanced.is-invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    background: rgba(220, 53, 69, 0.05);
}

.form-control-enhanced.is-invalid:focus {
    border-color: #dc3545;
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
    background: white;
}

.form-group.focused .form-control-enhanced.is-invalid {
    background: white;
}

/* Validation success states */
.form-control-enhanced.is-valid {
    border-color: #1cc88a;
    box-shadow: 0 0 0 0.2rem rgba(28, 200, 138, 0.15);
}

.form-control-enhanced.is-valid:focus {
    border-color: #1cc88a;
    box-shadow: 0 0 0 0.2rem rgba(28, 200, 138, 0.25);
}

.valid-feedback {
    display: none;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #1cc88a;
    background: linear-gradient(135deg, rgba(28, 200, 138, 0.1) 0%, rgba(28, 200, 138, 0.05) 100%);
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 3px solid #1cc88a;
}

/* Shake animation for invalid fields */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
    color: #fff;
    text-decoration: none;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Alert close button */
.btn-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: inherit;
    opacity: 0.7;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-close:hover {
    opacity: 1;
    background: rgba(0, 0, 0, 0.1);
}

.btn-close i {
    font-size: 0.875rem;
}

/* Connection status alerts */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.connection-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    min-width: 300px;
    animation: slideInRight 0.5s ease;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

/* ==============================================
   ACCESSIBILITY - การเข้าถึง
   ============================================== */

@media (prefers-reduced-motion: reduce) {
    .login-card,
    .btn-login,
    .form-control-enhanced,
    .error-alert,
    .system-error-alert {
        animation: none;
        transition: none;
    }
    
    .brand-logo,
    .brand-section::before {
        animation: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .login-card {
        border: 2px solid #000;
        background: white;
    }
    
    .brand-section {
        background: #000;
        color: white;
    }
    
    .form-control-enhanced {
        border: 2px solid #000;
        background: white;
    }
    
    .btn-login {
        background: #000;
        border: 2px solid #000;
    }
}

/* Focus indicators for keyboard navigation */
.form-control-enhanced:focus,
.btn-login:focus,
.test-system-link:focus {
    outline: 2px solid #1cc88a;
    outline-offset: 2px;
}
