/* modals.css - استایل مودال‌ها، فرم‌ها و تب‌ها */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
    overflow-y: visible;
    /* ← مطمئن شو visible هست */
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-tertiary);
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.tab-btn.active {
    color: var(--accent-color);
    border-bottom: 2px solid var(--accent-color);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.auth-message {
    margin-top: 16px;
    padding: 12px;
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
}

.auth-message.success {
    background: rgba(16, 163, 127, 0.1);
    color: var(--accent-color);
}

.auth-message.error {
    background: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
}

/* ============================================ */
/* استایل جدید مودال لاگین */
/* ============================================ */
.login-modal-content {
    position: relative;
    max-width: 440px;
    border-radius: 24px;
    overflow: hidden;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.login-modal-header {
    text-align: center;
    padding: 32px 24px 20px;
    background: linear-gradient(135deg, rgba(16, 163, 127, 0.05), rgba(99, 102, 241, 0.05));
}

.login-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    animation: loginPulse 2s ease-in-out infinite;
}

@keyframes loginPulse {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(16, 163, 127, 0.4);
    }

    50% {
        box-shadow: 0 0 0 12px rgba(16, 163, 127, 0);
    }
}

.login-avatar i {
    font-size: 28px;
    color: white;
}

.login-modal-header h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-primary);
}

.login-modal-header p {
    font-size: 13px;
    color: var(--text-tertiary);
}

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

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    background: var(--bg-secondary);
    border-radius: 14px;
    padding: 5px;
    border-bottom: none;
}

.login-tabs .tab-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.login-tabs .tab-btn.active {
    background: var(--accent-color);
    color: white;
    border-bottom: none;
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
}

.login-tabs .tab-btn:not(.active):hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.login-tabs .tab-btn i {
    font-size: 12px;
}

.login-submit-btn {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent-color), #059669);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(16, 163, 127, 0.3);
}

.login-submit-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 8px 24px rgba(16, 163, 127, 0.5);
}

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

.login-submit-btn i {
    font-size: 14px;
}

/* ============================================ */
/* چک‌لیست رمز عبور */
/* ============================================ */
.password-checklist {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.password-checklist span {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.password-checklist span i {
    font-size: 12px;
    width: 14px;
    text-align: center;
}

.password-checklist span.failed {
    color: var(--text-tertiary);
}

.password-checklist span.failed i {
    color: #e53e3e;
}

.password-checklist span.passed {
    color: #10a37f;
}

.password-checklist span.passed i {
    color: #10a37f;
}

.notification-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    animation: barShrink 4s linear forwards;
}

@keyframes barShrink {
    from {
        width: 100%;
    }

    to {
        width: 0%;
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

/* ============================================ */
/* مودال پروفایل - بازطراحی شده */
/* ============================================ */
.profile-modal-content {
    max-width: 480px;
    max-height: 85vh;
    border-radius: 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.profile-modal-header {
    position: relative;
    text-align: center;
    padding-bottom: 40px;
}

.profile-cover {
    height: 80px;
    background: linear-gradient(135deg, var(--accent-color), #6366f1, #8b5cf6);
    border-radius: 24px 24px 0 0;
}

.profile-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.profile-close:hover {
    background: rgba(255, 255, 255, 0.4);
}

.profile-avatar-large {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -40px auto 0;
    border: 4px solid var(--bg-primary);
    font-size: 32px;
    color: white;
    position: relative;
    z-index: 1;
    box-shadow: 0 8px 24px rgba(16, 163, 127, 0.3);
}

.profile-modal-body {
    padding: 8px 28px 28px;
    overflow-y: auto;
    flex: 1;
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.profile-row:last-child {
    border-bottom: none;
}

.profile-label {
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.profile-label i {
    width: 20px;
    text-align: center;
    color: var(--accent-color);
    font-size: 12px;
}

.profile-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-divider {
    text-align: center;
    margin: 20px 0 16px;
    position: relative;
}

.profile-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.profile-divider span {
    background: var(--bg-primary);
    padding: 0 16px;
    position: relative;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.profile-submit-btn {
    width: 100%;
    padding: 14px;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 700;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--accent-color), #059669);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 16px rgba(16, 163, 127, 0.3);
}

.profile-submit-btn:hover {
    box-shadow: 0 8px 24px rgba(16, 163, 127, 0.5);
}

/* ============================================ */
/* مودال تنظیمات - بازطراحی شده */
/* ============================================ */
.settings-modal-content {
    max-width: 500px;
    max-height: 85vh;
    border-radius: 24px;
    overflow: hidden;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.settings-modal-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 24px 24px 20px;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.03), rgba(16, 163, 127, 0.03));
    position: relative;
}

.settings-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-header-icon i {
    font-size: 20px;
    color: white;
}

.settings-modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.settings-modal-header p {
    font-size: 12px;
    color: var(--text-tertiary);
}

.settings-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.settings-close:hover {
    background: rgba(229, 62, 62, 0.1);
    color: #e53e3e;
    border-color: rgba(229, 62, 62, 0.3);
}

.settings-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.settings-section {
    margin-bottom: 24px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-section-title i {
    color: var(--accent-color);
    font-size: 14px;
}

.temperature-display {
    display: flex;
    align-items: center;
    gap: 16px;
}

.temperature-display input[type="range"] {
    flex: 1;
    accent-color: var(--accent-color);
    height: 6px;
}

.temp-value-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-color), #059669);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
}

.settings-select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.settings-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.settings-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.settings-cancel-btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.settings-save-btn {
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--accent-color), #059669);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.3);
    transition: all 0.3s ease;
}

.settings-save-btn:hover {
    box-shadow: 0 8px 24px rgba(16, 163, 127, 0.5);
    transform: translateY(-1px);
}

/* ============================================ */
/* اسکرول مودال لاگین در موبایل */
/* ============================================ */
@media (max-width: 768px) {
    .login-modal-content {
        max-height: 85vh;
        display: flex;
        flex-direction: column;
    }

    .login-modal-body {
        overflow-y: auto;
        flex: 1;
        -webkit-overflow-scrolling: touch;
        max-height: calc(85vh - 180px);
    }
}

/* ============ دکمه close مودال ============ */
.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    padding: 0;
    line-height: 1;
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
    transform: rotate(90deg);
}

.modal-close-btn:active {
    transform: rotate(90deg) scale(0.9);
}
/* ============================================ */
/* استایل دکمه چشم (Toggle Password) */
/* ============================================ */
.password-group {
    position: relative;
}

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-left: 44px !important; /* جا برای دکمه چشم در سمت چپ (راست‌چین) */
    width: 100%;
}

.password-toggle-btn {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    z-index: 2;
    padding: 0;
    line-height: 1;
}

.password-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.password-toggle-btn:active {
    transform: translateY(-50%) scale(0.9);
}