/* ============================================
   Modal Logowania - Nowoczesny Styl
   Obsługa jasnego i ciemnego motywu
   ============================================ */

.auth-modal {
    display: none;
    position: fixed !important;
    z-index: 99999 !important;
    left: 0 !important;
    top: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(15, 20, 30, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    justify-content: center;
    align-items: flex-start;
    padding-top: 80px;
    overflow: hidden;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Gdy modal jest otwarty, zapobiegaj scrollowaniu body */
body.modal-open {
    overflow: hidden;
}

/* ============ MODAL CONTENT - Jasny motyw ============ */
.auth-modal-content {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(248, 250, 255, 0.9));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 28px 32px;
    border-radius: 20px;
    max-width: 380px;
    width: 92%;
    overflow: visible;
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.15),
        0 10px 30px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.6);
    animation: modalSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    margin: auto;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Przycisk zamknięcia */
.auth-close {
    position: absolute;
    top: 16px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    color: #666;
    font-size: 24px;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    border: none;
    line-height: 1;
}

.auth-close:hover {
    background: rgba(255, 100, 100, 0.15);
    color: #ff4444;
    transform: rotate(90deg);
}

/* Nagłówek */
.auth-modal-content h2 {
    margin: 0 0 8px 0;
    font-size: 1.75rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.auth-subtitle {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 28px;
    font-weight: 400;
}

/* Pola formularza */
.auth-input-group {
    margin-bottom: 20px;
    position: relative;
}

.auth-input-group label {
    display: block;
    margin-bottom: 8px;
    color: #475569;
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.auth-input-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    color: #1e293b;
    box-sizing: border-box;
    transition: all 0.25s ease;
}

.auth-input-group input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.auth-input-group input:hover {
    border-color: #cbd5e1;
}

.auth-input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

/* Komunikat błędu */
.auth-error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #b91c1c;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid rgba(185, 28, 28, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-error::before {
    content: '⚠️';
    font-size: 1.1rem;
}

/* Przycisk logowania */
.auth-button {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 15px rgba(59, 130, 246, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.auth-button::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;
}

.auth-button:hover {
    transform: translateY(-2px);
    box-shadow: 
        0 8px 25px rgba(59, 130, 246, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.auth-button:hover::before {
    left: 100%;
}

.auth-button:active {
    transform: translateY(0) scale(0.98);
}

/* Linki pomocnicze */
.auth-help {
    margin-top: 20px;
    text-align: center;
    font-size: 0.875rem;
    color: #64748b;
}

.auth-help a {
    color: #3b82f6;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.auth-help a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Demo info */
.auth-demo-info {
    margin-top: 24px;
    padding: 16px;
    background: linear-gradient(135deg, #fefce8, #fef9c3);
    border: 1px solid rgba(202, 138, 4, 0.2);
    border-radius: 12px;
    font-size: 0.8rem;
}

.auth-demo-info p {
    margin: 6px 0;
    color: #854d0e;
}

.auth-demo-info code {
    background: rgba(255, 255, 255, 0.6);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-weight: 600;
    color: #92400e;
}

/* ============ CIEMNY MOTYW ============ */
body.dark-mode .auth-modal {
    background: rgba(10, 15, 25, 0.85);
}

body.dark-mode .auth-modal-content {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.95), rgba(15, 23, 42, 0.9));
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 25px 80px rgba(0, 0, 0, 0.5),
        0 10px 30px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

body.dark-mode .auth-close {
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

body.dark-mode .auth-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

body.dark-mode .auth-modal-content h2 {
    background: linear-gradient(135deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

body.dark-mode .auth-subtitle {
    color: #94a3b8;
}

body.dark-mode .auth-input-group label {
    color: #cbd5e1;
}

body.dark-mode .auth-input-group input {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(71, 85, 105, 0.5);
    color: #f1f5f9;
}

body.dark-mode .auth-input-group input::placeholder {
    color: #64748b;
}

body.dark-mode .auth-input-group input:hover {
    border-color: rgba(100, 116, 139, 0.6);
}

body.dark-mode .auth-input-group input:focus {
    background: rgba(30, 41, 59, 1);
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.25);
}

body.dark-mode .auth-error {
    background: linear-gradient(135deg, rgba(127, 29, 29, 0.4), rgba(153, 27, 27, 0.3));
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.3);
}

body.dark-mode .auth-button {
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 50%, #7c3aed 100%);
    box-shadow: 
        0 4px 15px rgba(99, 102, 241, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

body.dark-mode .auth-button:hover {
    box-shadow: 
        0 8px 30px rgba(99, 102, 241, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

body.dark-mode .auth-help {
    color: #94a3b8;
}

body.dark-mode .auth-help a {
    color: #60a5fa;
}

body.dark-mode .auth-help a:hover {
    color: #93c5fd;
}

body.dark-mode .auth-demo-info {
    background: linear-gradient(135deg, rgba(120, 53, 15, 0.3), rgba(146, 64, 14, 0.2));
    border-color: rgba(217, 119, 6, 0.3);
}

body.dark-mode .auth-demo-info p {
    color: #fcd34d;
}

body.dark-mode .auth-demo-info code {
    background: rgba(0, 0, 0, 0.3);
    color: #fbbf24;
}

/* ============ Panel statusu klienta ============ */
.customer-status-panel {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 255, 0.85));
    backdrop-filter: blur(10px);
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin: 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.customer-status-panel h3 {
    margin-top: 0;
    color: #1e293b;
    border-bottom: 2px solid #3b82f6;
    padding-bottom: 12px;
    font-weight: 700;
}

.status-section {
    margin: 20px 0;
    padding: 16px;
    background: rgba(248, 250, 255, 0.8);
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.status-section h4 {
    margin-top: 0;
    color: #475569;
    font-weight: 600;
}

.status-section p {
    margin: 10px 0;
    font-size: 0.9rem;
    color: #64748b;
}

.status-section strong {
    font-weight: 600;
    color: #1e293b;
}

body.dark-mode .customer-status-panel {
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.85));
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .customer-status-panel h3 {
    color: #f1f5f9;
    border-bottom-color: #60a5fa;
}

body.dark-mode .status-section {
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(71, 85, 105, 0.4);
}

body.dark-mode .status-section h4 {
    color: #cbd5e1;
}

body.dark-mode .status-section p {
    color: #94a3b8;
}

body.dark-mode .status-section strong {
    color: #f1f5f9;
}

/* ============ Przyciski w nagłówku czatu ============ */
#chatLoginButton,
#chatLogoutButton {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#chatLoginButton {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

#chatLoginButton:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.5);
}

#chatLogoutButton {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    display: none;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

#chatLogoutButton:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.5);
}

#chatCustomerInfo {
    display: none;
    padding: 8px 16px;
    background: linear-gradient(135deg, #dcfce7, #bbf7d0);
    color: #166534;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

body.dark-mode #chatCustomerInfo {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.15));
    color: #86efac;
}

/* ============ Responsywność ============ */
@media (max-width: 480px) {
    .auth-modal-content {
        padding: 28px 20px;
        border-radius: 20px;
        margin: 16px;
        width: calc(100% - 32px);
    }
    
    .auth-modal-content h2 {
        font-size: 1.5rem;
    }
    
    .auth-input-group input {
        padding: 12px 14px;
    }
    
    .auth-button {
        padding: 14px 20px;
    }
    
    .customer-status-panel {
        padding: 16px;
    }
}
