/* Modal Styles for Login/Register */

.auth-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    animation: fadeIn 0.3s ease;
}

.auth-modal-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.auth-modal {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

.auth-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.3s;
    z-index: 10;
}

.auth-modal-close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.auth-modal-content {
    padding: 2.5rem;
}

.auth-modal-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-modal-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.auth-modal-logo-icon {
    width: 48px;
    height: 48px;
    background: #156358;
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.5rem;
}

.auth-modal-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
}

.auth-modal-header p {
    color: #6b7280;
    font-size: 0.875rem;
}

.auth-form-group {
    margin-bottom: 1.5rem;
}

.auth-form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1a1a1a;
    font-size: 0.875rem;
}

.auth-form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s, box-shadow 0.3s;
}

.auth-form-group input:focus {
    outline: none;
    border-color: #156358;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.auth-btn-primary {
    width: 100%;
    padding: 0.875rem 1rem;
    background: #156358;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    font-family: inherit;
}

.auth-btn-primary:hover {
    background: #0f4c43;
}

.auth-btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.auth-modal-footer {
    text-align: center;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.auth-modal-footer p {
    color: #6b7280;
    font-size: 0.875rem;
}

.auth-modal-footer button {
    background: none;
    border: none;
    color: #156358;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
}

.auth-modal-footer button:hover {
    text-decoration: underline;
}

.auth-alert {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.auth-alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.auth-alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.password-hint {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

/* Responsive */
@media (max-width: 768px) {
    .auth-modal {
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        margin-top: auto;
    }
    
    .auth-modal-content {
        padding: 2rem 1.5rem;
    }
}

/* ===================================
   สไตล์สำหรับสถานะล็อกอิน
   =================================== */

/* บุ่มผู้ใช้เมื่อล็อกอินแล้ว */
.btn-icon.user-menu-btn.logged-in {
    background: linear-gradient(135deg, #0f4c43 0%, #1d4ed8 100%);
    color: white;
    padding: 0.5rem;
    width: 40px;
    height: 40px;
    border: 2px solid #156358;
    position: relative;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* เมื่อมีรูป avatar ให้ลบกรอบและ background */
.btn-icon.user-menu-btn.logged-in.has-avatar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid white;
    padding: 0;
    overflow: hidden;
    box-shadow: 
        0 0 0 2px #667eea,
        0 8px 16px rgba(102, 126, 234, 0.4),
        0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-icon.user-menu-btn.logged-in:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    border-color: #0f4c43;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* เมื่อมีรูป avatar hover */
.btn-icon.user-menu-btn.logged-in.has-avatar:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    border-color: white;
    box-shadow: 
        0 0 0 2px #667eea,
        0 12px 24px rgba(102, 126, 234, 0.5),
        0 6px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-3px) scale(1.08);
}

/* Active State - Avatar */
.btn-icon.user-menu-btn.logged-in.has-avatar:active {
    transform: translateY(-1px) scale(1.05);
}

/* Focus State - Avatar */
.btn-icon.user-menu-btn.logged-in.has-avatar:focus {
    outline: none;
    box-shadow: 
        0 0 0 2px #667eea,
        0 0 0 4px rgba(102, 126, 234, 0.3),
        0 8px 16px rgba(102, 126, 234, 0.4);
}

/* ซ่อนชื่อผู้ใช้ (ไม่ใช้แล้ว) */
.username-display {
    display: none;
}

/* Badge สถานะออนไลน์ */
.login-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

/* ไอคอน SVG ในปุ่มล็อกอิน */
.btn-icon.user-menu-btn.logged-in svg {
    stroke: white;
}

/* Avatar Image Styling */
.user-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}
