/* ============================================================
   modal.css — Quản Lý Toa Chanh
   Modals: overlay, password modal, seller modal, confirm dialog
   ============================================================ */

/* ===== Modal Overlay ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== Modal Box ===== */
.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-overlay.active .modal {
    transform: scale(1);
}


/* ===== Modal Header ===== */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--border);
    color: var(--text-muted);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.modal-close:hover {
    background: #FECACA;
    color: #DC2626;
}

/* ===== Modal Body ===== */
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-body .form-group {
    margin-bottom: 14px;
}

.modal-body .form-group:last-child {
    margin-bottom: 0;
}

/* ===== Modal Footer ===== */
.modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: var(--bg);
    flex-shrink: 0;
}

.modal-footer .btn {
    flex: 1;
}

/* ===== Password Modal Specific ===== */
#passwordModal .modal-header {
    background: linear-gradient(135deg, var(--green-bg), #fff);
}

#passwordModal .modal-header h3 {
    color: var(--green-primary);
}

.password-strength {
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin-top: 6px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background 0.3s;
    width: 0%;
}

.password-strength-bar.weak {
    background: #EF4444;
    width: 33%;
}

.password-strength-bar.medium {
    background: #F59E0B;
    width: 66%;
}

.password-strength-bar.strong {
    background: #10B981;
    width: 100%;
}

/* ===== Seller Modal Specific ===== */
#sellerModal .modal-header {
    background: linear-gradient(135deg, #EFF6FF, #fff);
}

#sellerModal .modal-header h3 {
    color: #1D4ED8;
}

/* ===== Confirm Dialog ===== */
.confirm-modal .modal {
    max-width: 340px;
    text-align: center;
}

.confirm-modal .modal-body {
    padding: 24px 20px 16px;
}

.confirm-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.confirm-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 6px;
}

.confirm-message {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.confirm-modal .modal-footer {
    justify-content: center;
}

/* ===== Input Password Toggle ===== */
.input-password-wrap {
    position: relative;
}

.input-password-wrap input {
    padding-right: 44px;
}

.input-password-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    font-size: 1rem;
    line-height: 1;
}

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

/* ===== Seller List in Modal ===== */
.seller-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
}

.seller-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    font-size: 0.82rem;
}

.seller-list-item:hover {
    background: var(--green-bg);
    border-color: var(--green-border);
}

.seller-list-item .seller-name {
    font-weight: 600;
}

.seller-list-item .seller-info {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.seller-delete-btn {
    background: none;
    border: none;
    color: #DC2626;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    transition: background 0.15s;
}

.seller-delete-btn:hover {
    background: #FEF2F2;
}

/* ===== Modal Tabs ===== */
.modal-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    background: var(--bg);
    flex-shrink: 0;
}

.modal-tab {
    padding: 10px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    transition: color 0.15s, border-color 0.15s;
}

.modal-tab.active {
    color: var(--green-primary);
    border-bottom-color: var(--green-primary);
}

.modal-tab-panel {
    display: none;
}

.modal-tab-panel.active {
    display: block;
}

/* ===== Error message in modal ===== */
.modal-error {
    background: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FECACA;
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 0.8rem;
    margin-bottom: 12px;
    display: none;
}

.modal-error.show {
    display: block;
}