/* ===== MODAL OVERLAY ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    padding: 1.5rem;
    opacity: 0; visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}
.modal-overlay.active {
    opacity: 1; visibility: visible;
}

/* ===== MODAL BOX ===== */
.modal-box {
    width: 100%; max-width: 520px; max-height: 90vh;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.5), 0 0 60px rgba(59, 130, 246, 0.06);
    padding: 2.5rem 2rem 2rem;
    position: relative;
    transform: translateY(20px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.23, 1, 0.32, 1);
}
.modal-overlay.active .modal-box {
    transform: translateY(0) scale(1);
}

/* Scrollbar inside modal */
.modal-box::-webkit-scrollbar { width: 6px; }
.modal-box::-webkit-scrollbar-track { background: transparent; }
.modal-box::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }

/* ===== CLOSE BUTTON ===== */
.modal-close {
    position: absolute; top: 16px; right: 16px;
    width: 36px; height: 36px; border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.3s ease;
}
.modal-close:hover {
    background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2);
}
.modal-close svg { width: 18px; height: 18px; stroke: rgba(255, 255, 255, 0.5); stroke-width: 2; }

/* ===== MODAL HEADER ===== */
.modal-header {
    text-align: center; margin-bottom: 2rem;
}
.modal-header-icon {
    width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
}
.modal-header-icon svg { width: 28px; height: 28px; }
.modal-header-icon.mhi-blue {
    background: linear-gradient(135deg, rgba(59,130,246,0.15), rgba(59,130,246,0.05));
}
.modal-header-icon.mhi-blue svg { stroke: #60a5fa; }
.modal-header-icon.mhi-cyan {
    background: linear-gradient(135deg, rgba(6,182,212,0.15), rgba(6,182,212,0.05));
}
.modal-header-icon.mhi-cyan svg { stroke: #22d3ee; }
.modal-header-icon.mhi-red {
    background: linear-gradient(135deg, rgba(239,68,68,0.15), rgba(239,68,68,0.05));
}
.modal-header-icon.mhi-red svg { stroke: #f87171; }

.modal-header h2 {
    font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em;
    margin-bottom: 0.5rem; color: #fff;
}
.modal-header p {
    font-size: 0.9rem; color: rgba(224, 228, 239, 0.5); line-height: 1.5;
}

/* ===== FORM ===== */
.modal-form {
    display: flex; flex-direction: column; gap: 1rem;
}
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-label {
    font-size: 0.8rem; font-weight: 600; color: rgba(224, 228, 239, 0.6);
    letter-spacing: 0.02em;
}
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px; color: #e0e4ef;
    font-family: 'Inter', sans-serif; font-size: 0.9rem;
    transition: all 0.3s ease; outline: none;
}
.form-input::placeholder, .form-textarea::placeholder {
    color: rgba(224, 228, 239, 0.25);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.08);
}
.form-select {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='rgba(224,228,239,0.4)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
    padding-right: 2.5rem; cursor: pointer;
}
.form-select option { background: #1e293b; color: #e0e4ef; }
.form-textarea { resize: vertical; min-height: 80px; }

/* Checkbox group */
.form-checkboxes {
    display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.form-checkbox-item {
    display: flex; align-items: center; gap: 0.5rem;
    padding: 0.5rem 0.85rem; border-radius: 10px;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
    cursor: pointer; transition: all 0.2s ease;
    font-size: 0.82rem; color: rgba(224,228,239,0.6);
}
.form-checkbox-item:hover {
    border-color: rgba(255,255,255,0.12); background: rgba(255,255,255,0.06);
}
.form-checkbox-item input[type="checkbox"] {
    width: 16px; height: 16px; accent-color: #3b82f6; cursor: pointer;
}

/* ===== SUBMIT BUTTON ===== */
.modal-submit {
    width: 100%; padding: 0.9rem 1.5rem; margin-top: 0.5rem;
    border: none; border-radius: 14px; cursor: pointer;
    font-family: 'Inter', sans-serif; font-size: 1rem; font-weight: 600;
    color: #fff; display: flex; align-items: center; justify-content: center; gap: 0.5rem;
    transition: all 0.3s ease;
}
.modal-submit svg { width: 18px; height: 18px; transition: transform 0.3s ease; }
.modal-submit:hover svg { transform: translateX(3px); }

.modal-submit.ms-blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 4px 20px rgba(59,130,246,0.3);
}
.modal-submit.ms-blue:hover { box-shadow: 0 8px 30px rgba(59,130,246,0.45); transform: translateY(-1px); }

.modal-submit.ms-cyan {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    box-shadow: 0 4px 20px rgba(6,182,212,0.3);
}
.modal-submit.ms-cyan:hover { box-shadow: 0 8px 30px rgba(6,182,212,0.45); transform: translateY(-1px); }

.modal-submit.ms-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 20px rgba(239,68,68,0.3);
}
.modal-submit.ms-red:hover { box-shadow: 0 8px 30px rgba(239,68,68,0.45); transform: translateY(-1px); }

/* ===== SUCCESS STATE ===== */
.modal-success {
    display: none; text-align: center; padding: 2rem 0;
}
.modal-success.active { display: block; }
.modal-form.hidden { display: none; }

.modal-success-icon {
    width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, rgba(34,197,94,0.15), rgba(34,197,94,0.05));
    border: 2px solid rgba(34,197,94,0.2);
    display: flex; align-items: center; justify-content: center;
}
.modal-success-icon svg { width: 36px; height: 36px; stroke: #4ade80; stroke-width: 2; }
.modal-success h3 {
    font-size: 1.35rem; font-weight: 700; margin-bottom: 0.75rem; color: #fff;
}
.modal-success p {
    font-size: 0.92rem; color: rgba(224,228,239,0.5); line-height: 1.6;
    max-width: 360px; margin: 0 auto;
}

/* ===== PRIVACY NOTE ===== */
.form-privacy {
    font-size: 0.72rem; color: rgba(224,228,239,0.3); text-align: center;
    line-height: 1.5; margin-top: 0.25rem;
}

/* ===== LIGHT MODE ===== */
[data-theme="light"] .modal-overlay {
    background: rgba(0, 0, 0, 0.35);
}
[data-theme="light"] .modal-box {
    background: rgba(255, 255, 255, 0.97);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.15), 0 0 60px rgba(59, 130, 246, 0.04);
}
[data-theme="light"] .modal-close {
    border-color: rgba(0, 0, 0, 0.08); background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .modal-close:hover {
    background: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] .modal-close svg { stroke: rgba(30, 41, 59, 0.5); }
[data-theme="light"] .modal-header h2 { color: #0f172a; }
[data-theme="light"] .modal-header p { color: rgba(30, 41, 59, 0.5); }
[data-theme="light"] .form-label { color: rgba(30, 41, 59, 0.7); }
[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
    background: rgba(0, 0, 0, 0.03); border-color: rgba(0, 0, 0, 0.1);
    color: #1e293b;
}
[data-theme="light"] .form-input::placeholder,
[data-theme="light"] .form-textarea::placeholder {
    color: rgba(30, 41, 59, 0.3);
}
[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-textarea:focus {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(0, 0, 0, 0.02);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.06);
}
[data-theme="light"] .form-select option { background: #fff; color: #1e293b; }
[data-theme="light"] .form-checkbox-item {
    background: rgba(0,0,0,0.02); border-color: rgba(0,0,0,0.08);
    color: rgba(30,41,59,0.7);
}
[data-theme="light"] .form-checkbox-item:hover {
    background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.12);
}
[data-theme="light"] .modal-success h3 { color: #0f172a; }
[data-theme="light"] .modal-success p { color: rgba(30, 41, 59, 0.55); }
[data-theme="light"] .form-privacy { color: rgba(30, 41, 59, 0.35); }

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
    .modal-box { padding: 2rem 1.25rem 1.5rem; border-radius: 20px; }
    .form-row { grid-template-columns: 1fr; }
    .modal-header h2 { font-size: 1.25rem; }
}
