/* =====================================================
   MODAL STYLES – THEME COMPATIBLE (LIGHT / DARK / PURPLE / GREEN)
   Depends on body.theme-* variables from layout css
   ===================================================== */

/* ---------- Modal Overlay ---------- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
}

/* ---------- Modal Container ---------- */
.modal-content {
    margin: 8% auto;
    width: 90%;
    max-width: 520px;
    border-radius: 0.75rem;
    padding: 1.5rem;
    position: relative;
    animation: modal-slide-down 0.35s ease-out;
    transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

/* ---------- Modal Header ---------- */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
}

/* ---------- Close Button ---------- */
.modal-close {
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
    background: transparent;
    line-height: 1;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 0.7;
}

/* ---------- Modal Body ---------- */
.modal-body {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* ---------- Modal Footer ---------- */
.modal-footer {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* ---------- Form Elements ---------- */
.modal .form-group {
    margin-bottom: 1rem;
}

.modal .form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
    width: 100%;
    padding: 0.5rem 0.6rem;
    border-radius: 0.375rem;
    border: 1px solid;
    font-size: 0.9rem;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

/* ---------- Messages ---------- */
.modal-msg-success,
.modal-msg-danger {
    padding: 0.6rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.85rem;
    margin-top: 0.75rem;
}

/* =====================================================
   THEME OVERRIDES
   ===================================================== */

/* ---------- Light Theme ---------- */
body.theme-light .modal-content {
    background-color: #ffffff;
    color: #111827;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body.theme-light .modal-title {
    color: #2563eb;
}

body.theme-light .modal-close {
    color: #374151;
}

body.theme-light .modal .form-group input,
body.theme-light .modal .form-group select,
body.theme-light .modal .form-group textarea {
    background-color: #ffffff;
    color: #111827;
    border-color: #d1d5db;
}

body.theme-light .modal-msg-success {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

body.theme-light .modal-msg-danger {
    background-color: #fee2e2;
    color: #7f1d1d;
    border: 1px solid #fca5a5;
}

/* ---------- Dark Theme ---------- */
body.theme-dark .modal-content {
    background-color: #1f2937;
    color: #f9fafb;
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.08);
}

body.theme-dark .modal-title {
    color: #60a5fa;
}

body.theme-dark .modal-close {
    color: #e5e7eb;
}

body.theme-dark .modal .form-group input,
body.theme-dark .modal .form-group select,
body.theme-dark .modal .form-group textarea {
    background-color: #374151;
    color: #f9fafb;
    border-color: #4b5563;
}

body.theme-dark .modal-msg-success {
    background-color: #064e3b;
    color: #d1fae5;
    border: 1px solid #065f46;
}

body.theme-dark .modal-msg-danger {
    background-color: #7f1d1d;
    color: #fee2e2;
    border: 1px solid #991b1b;
}

/* ---------- Purple Theme ---------- */
body.theme-purple .modal-content {
    background-color: #6b21a8;
    color: #f3e8ff;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

body.theme-purple .modal-title {
    color: #f5d0fe;
}

body.theme-purple .modal-close {
    color: #f3e8ff;
}

body.theme-purple .modal .form-group input,
body.theme-purple .modal .form-group select,
body.theme-purple .modal .form-group textarea {
    background-color: #7e22ce;
    color: #f3e8ff;
    border-color: #9333ea;
}

body.theme-purple .modal-msg-success {
    background-color: #3b0764;
    color: #f3e8ff;
}

body.theme-purple .modal-msg-danger {
    background-color: #581c87;
    color: #fde68a;
}

/* ---------- Green Theme ---------- */
body.theme-green .modal-content {
    background-color: #065f46;
    color: #d1fae5;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

body.theme-green .modal-title {
    color: #a7f3d0;
}

body.theme-green .modal-close {
    color: #d1fae5;
}

body.theme-green .modal .form-group input,
body.theme-green .modal .form-group select,
body.theme-green .modal .form-group textarea {
    background-color: #059669;
    color: #d1fae5;
    border-color: #047857;
}

body.theme-green .modal-msg-success {
    background-color: #064e3b;
    color: #ecfdf5;
}

body.theme-green .modal-msg-danger {
    background-color: #14532d;
    color: #fef3c7;
}

/* ---------- Animation ---------- */
@keyframes modal-slide-down {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
