/* =========================================================
   VENDOR APP — MODAL SYSTEM
   File: /vendor_app/assets/css/modal.css
   ========================================================= */

/* ---------------------------------------------------------
   1. MODAL OVERLAY
   --------------------------------------------------------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: none;
    align-items: center;
    justify-content: center;

    width: 100%;
    height: 100%;

    padding: 20px;

    background: rgba(15, 23, 42, 0.55);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease;
}

.modal.is-open,
.modal.show,
.modal.active {
    display: flex;
    opacity: 1;
    visibility: visible;
}

/* ---------------------------------------------------------
   2. MODAL BACKDROP
   --------------------------------------------------------- */

.modal-backdrop {
    position: absolute;
    inset: 0;

    width: 100%;
    height: 100%;

    background: rgba(15, 23, 42, 0.55);

    cursor: pointer;
}

/* ---------------------------------------------------------
   3. MODAL DIALOG
   --------------------------------------------------------- */

.modal-dialog {
    position: relative;
    z-index: 1001;

    display: flex;
    flex-direction: column;

    width: 100%;
    max-width: 520px;
    max-height: calc(100vh - 40px);

    margin: auto;

    background: #ffffff;

    border: 1px solid #e5e7eb;
    border-radius: 14px;

    box-shadow:
        0 20px 50px rgba(15, 23, 42, 0.18),
        0 8px 20px rgba(15, 23, 42, 0.08);

    overflow: hidden;

    transform: translateY(10px) scale(0.98);

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;

    opacity: 0;
}

.modal.is-open .modal-dialog,
.modal.show .modal-dialog,
.modal.active .modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ---------------------------------------------------------
   4. MODAL SIZES
   --------------------------------------------------------- */

.modal-sm .modal-dialog {
    max-width: 380px;
}

.modal-md .modal-dialog {
    max-width: 520px;
}

.modal-lg .modal-dialog {
    max-width: 760px;
}

.modal-xl .modal-dialog {
    max-width: 1000px;
}

.modal-full .modal-dialog {
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
}

/* ---------------------------------------------------------
   5. MODAL HEADER
   --------------------------------------------------------- */

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;

    padding: 20px 24px;

    background: #ffffff;

    border-bottom: 1px solid #e5e7eb;
}

.modal-header-content {
    min-width: 0;
    flex: 1;
}

.modal-title {
    margin: 0;

    color: #111827;

    font-size: 18px;
    font-weight: 700;
    line-height: 1.4;
}

.modal-subtitle {
    margin: 5px 0 0;

    color: #6b7280;

    font-size: 13px;
    font-weight: 400;
    line-height: 1.5;
}

/* ---------------------------------------------------------
   6. MODAL CLOSE BUTTON
   --------------------------------------------------------- */

.modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    width: 36px;
    height: 36px;

    padding: 0;

    color: #6b7280;

    background: transparent;

    border: 0;
    border-radius: 8px;

    font-size: 22px;
    line-height: 1;

    cursor: pointer;

    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.modal-close:hover {
    color: #111827;
    background: #f3f4f6;
}

.modal-close:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* ---------------------------------------------------------
   7. MODAL BODY
   --------------------------------------------------------- */

.modal-body {
    flex: 1 1 auto;

    min-height: 0;

    padding: 24px;

    color: #374151;

    font-size: 14px;
    line-height: 1.6;

    overflow-y: auto;
}

.modal-body p:first-child {
    margin-top: 0;
}

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

/* ---------------------------------------------------------
   8. MODAL FOOTER
   --------------------------------------------------------- */

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 10px;

    padding: 16px 24px;

    background: #ffffff;

    border-top: 1px solid #e5e7eb;
}

.modal-footer-left {
    margin-right: auto;

    display: flex;
    align-items: center;
    gap: 8px;
}

/* ---------------------------------------------------------
   9. MODAL BUTTONS
   --------------------------------------------------------- */

.modal-footer .button {
    min-width: 90px;
}

/* ---------------------------------------------------------
   10. CONFIRMATION MODAL
   --------------------------------------------------------- */

.confirmation-modal .modal-dialog {
    max-width: 440px;
}

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

.confirmation-content {
    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;
}

.confirmation-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 52px;
    height: 52px;

    margin-bottom: 16px;

    border-radius: 50%;

    font-size: 24px;
}

.confirmation-icon-info {
    color: #2563eb;
    background: #eff6ff;
}

.confirmation-icon-success {
    color: #16a34a;
    background: #f0fdf4;
}

.confirmation-icon-warning {
    color: #d97706;
    background: #fffbeb;
}

.confirmation-icon-danger {
    color: #dc2626;
    background: #fef2f2;
}

.confirmation-title {
    margin: 0;

    color: #111827;

    font-size: 18px;
    font-weight: 700;
}

.confirmation-message {
    margin: 8px 0 0;

    max-width: 360px;

    color: #6b7280;

    font-size: 14px;
    line-height: 1.6;
}

/* ---------------------------------------------------------
   11. DELETE MODAL
   --------------------------------------------------------- */

.delete-modal .modal-dialog {
    max-width: 440px;
}

.delete-modal .confirmation-icon {
    color: #dc2626;
    background: #fef2f2;
}

.delete-modal .modal-footer .button-danger {
    color: #ffffff;
    background: #dc2626;
    border-color: #dc2626;
}

.delete-modal .modal-footer .button-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* ---------------------------------------------------------
   12. FORM MODAL
   --------------------------------------------------------- */

.form-modal .modal-dialog {
    max-width: 640px;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.modal-form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.modal-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modal-form-group-full {
    grid-column: 1 / -1;
}

/* ---------------------------------------------------------
   13. SEARCH MODAL
   --------------------------------------------------------- */

.search-modal .modal-dialog {
    max-width: 720px;

    margin-top: 8vh;

    align-self: flex-start;
}

.search-modal .modal-header {
    padding-bottom: 14px;
}

.search-modal .modal-body {
    padding-top: 14px;
}

.search-modal-input-wrapper {
    position: relative;

    display: flex;
    align-items: center;
}

.search-modal-input {
    width: 100%;

    min-height: 48px;

    padding: 0 16px 0 44px;

    color: #111827;

    background: #f9fafb;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    font-size: 15px;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background 0.15s ease;
}

.search-modal-input:focus {
    background: #ffffff;

    border-color: #2563eb;

    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.search-modal-icon {
    position: absolute;
    left: 15px;

    color: #6b7280;

    pointer-events: none;
}

.search-modal-results {
    display: flex;
    flex-direction: column;

    margin-top: 14px;
}

.search-modal-result {
    display: flex;
    align-items: center;

    gap: 12px;

    padding: 12px;

    color: #374151;

    text-decoration: none;

    border-radius: 8px;

    transition:
        color 0.15s ease,
        background 0.15s ease;
}

.search-modal-result:hover {
    color: #111827;
    background: #f3f4f6;
}

/* ---------------------------------------------------------
   14. NOTIFICATION MODAL / PANEL
   --------------------------------------------------------- */

.notification-modal .modal-dialog {
    max-width: 520px;
}

.notification-list {
    display: flex;
    flex-direction: column;

    margin: -24px;
}

.notification-item {
    display: flex;

    gap: 12px;

    padding: 16px 24px;

    text-decoration: none;

    border-bottom: 1px solid #f0f0f0;

    transition: background 0.15s ease;
}

.notification-item:last-child {
    border-bottom: 0;
}

.notification-item:hover {
    background: #f9fafb;
}

.notification-item.unread {
    background: #eff6ff;
}

.notification-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 auto;

    width: 36px;
    height: 36px;

    border-radius: 50%;

    background: #f3f4f6;
}

.notification-item-content {
    min-width: 0;
    flex: 1;
}

.notification-item-title {
    margin: 0;

    color: #111827;

    font-size: 14px;
    font-weight: 600;
}

.notification-item-message {
    margin: 3px 0 0;

    color: #6b7280;

    font-size: 13px;
    line-height: 1.5;
}

.notification-item-time {
    display: block;

    margin-top: 5px;

    color: #9ca3af;

    font-size: 11px;
}

/* ---------------------------------------------------------
   15. LOADING STATE
   --------------------------------------------------------- */

.modal-loading {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 160px;

    padding: 30px;
}

.modal-spinner {
    width: 34px;
    height: 34px;

    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;

    border-radius: 50%;

    animation: modal-spinner-rotate 0.75s linear infinite;
}

@keyframes modal-spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

/* ---------------------------------------------------------
   16. EMPTY STATE
   --------------------------------------------------------- */

.modal-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    min-height: 180px;

    padding: 32px;

    text-align: center;
}

.modal-empty-icon {
    margin-bottom: 12px;

    color: #9ca3af;

    font-size: 32px;
}

.modal-empty-title {
    margin: 0;

    color: #374151;

    font-size: 15px;
    font-weight: 600;
}

.modal-empty-text {
    margin: 5px 0 0;

    max-width: 320px;

    color: #6b7280;

    font-size: 13px;
}

/* ---------------------------------------------------------
   17. ALERT INSIDE MODAL
   --------------------------------------------------------- */

.modal-alert {
    display: flex;
    align-items: flex-start;

    gap: 10px;

    margin-bottom: 18px;

    padding: 12px 14px;

    border: 1px solid transparent;
    border-radius: 8px;

    font-size: 13px;
    line-height: 1.5;
}

.modal-alert:last-child {
    margin-bottom: 0;
}

.modal-alert-info {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.modal-alert-success {
    color: #15803d;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.modal-alert-warning {
    color: #b45309;
    background: #fffbeb;
    border-color: #fde68a;
}

.modal-alert-danger {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

/* ---------------------------------------------------------
   18. SCROLLBAR
   --------------------------------------------------------- */

.modal-body::-webkit-scrollbar {
    width: 7px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* ---------------------------------------------------------
   19. BODY LOCK
   --------------------------------------------------------- */

body.modal-open {
    overflow: hidden;
}

/* ---------------------------------------------------------
   20. MOBILE
   --------------------------------------------------------- */

@media (max-width: 767px) {

    .modal {
        align-items: flex-end;

        padding: 0;
    }

    .modal-dialog,
    .modal-sm .modal-dialog,
    .modal-md .modal-dialog,
    .modal-lg .modal-dialog,
    .modal-xl .modal-dialog,
    .modal-full .modal-dialog {
        width: 100%;
        max-width: 100%;

        max-height: calc(100vh - 12px);

        margin: 0;

        border-radius: 16px 16px 0 0;

        transform: translateY(20px);
    }

    .modal.is-open .modal-dialog,
    .modal.show .modal-dialog,
    .modal.active .modal-dialog {
        transform: translateY(0);
    }

    .modal-header {
        padding: 16px 18px;
    }

    .modal-body {
        padding: 18px;
    }

    .modal-footer {
        padding: 14px 18px;

        flex-wrap: wrap;
    }

    .modal-footer .button {
        flex: 1 1 auto;
    }

    .modal-form-row {
        grid-template-columns: 1fr;
    }

    .modal-form-group-full {
        grid-column: auto;
    }

    .confirmation-modal .modal-body {
        padding: 24px 18px;
    }

    .search-modal .modal-dialog {
        margin-top: 0;
    }

    .notification-list {
        margin: -18px;
    }

    .notification-item {
        padding: 14px 18px;
    }
}

/* ---------------------------------------------------------
   21. SMALL MOBILE
   --------------------------------------------------------- */

@media (max-width: 480px) {

    .modal-close {
        width: 32px;
        height: 32px;

        font-size: 20px;
    }

    .modal-title {
        font-size: 16px;
    }

    .modal-subtitle {
        font-size: 12px;
    }

    .modal-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .modal-footer .button {
        width: 100%;
    }

    .modal-footer-left {
        width: 100%;
        margin-right: 0;
    }
}

/* ---------------------------------------------------------
   22. REDUCED MOTION
   --------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {

    .modal,
    .modal-dialog,
    .modal-close,
    .search-modal-input,
    .search-modal-result {
        transition: none;
    }

    .modal-spinner {
        animation: none;
    }
}

/* ---------------------------------------------------------
   23. PRINT
   --------------------------------------------------------- */

@media print {

    .modal {
        display: none !important;
    }
}