/* ══════════════════════════════════════════════════════════════
   OCIP Modal System
   ══════════════════════════════════════════════════════════════ */

/* Backdrop */
.ocip-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 5000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: modalFadeIn .2s ease;
    overflow-y: auto;
}

.ocip-modal.active {
    display: flex;
}

/* Dialog box */
.ocip-modal-dialog {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 2rem);
    display: flex;
    flex-direction: column;
    animation: modalSlideUp .25s ease;
    overflow: hidden;
    margin: auto;
}

.ocip-modal-dialog.modal-sm  { max-width: 400px; }
.ocip-modal-dialog.modal-lg  { max-width: 800px; }
.ocip-modal-dialog.modal-xl  { max-width: 1100px; }
.ocip-modal-dialog.modal-full { max-width: 98vw; max-height: 96vh; }

/* Header */
.ocip-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    border-radius: 14px 14px 0 0;
}

.ocip-modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.ocip-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 1.25rem;
    transition: background .15s, color .15s;
    flex-shrink: 0;
}

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

/* Body — scrollable */
.ocip-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}

.ocip-modal-body::-webkit-scrollbar { width: 5px; }
.ocip-modal-body::-webkit-scrollbar-track { background: transparent; }
.ocip-modal-body::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.ocip-modal-body::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Footer — sticky at bottom */
.ocip-modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: .75rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    background: #fff;
    position: sticky;
    bottom: 0;
    border-radius: 0 0 14px 14px;
}

/* Animations */
@keyframes modalFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes modalSlideUp {
    from { transform: translateY(24px) scale(.97); opacity: 0; }
    to   { transform: translateY(0)    scale(1);   opacity: 1; }
}

/* ── CONFIRM MODAL ─────────────────────────────────────────────── */
.confirm-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1rem;
}

.confirm-modal-icon.danger  { background: #fee2e2; color: #ef4444; }
.confirm-modal-icon.warning { background: #fef3c7; color: #f59e0b; }
.confirm-modal-icon.info    { background: #dbeafe; color: #3b82f6; }

/* ── ALERT / NOTIFICATION MODAL ───────────────────────────────── */
.ocip-modal-dialog.modal-alert .ocip-modal-body {
    text-align: center;
    padding: 2rem 1.5rem;
}

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ocip-modal {
        padding: 0;
        align-items: flex-end;
        overflow: hidden;
    }
    .ocip-modal-dialog {
        border-radius: 20px 20px 0 0;
        max-height: 92vh;
        max-width: 100%;
        width: 100%;
        margin: 0;
        animation: modalSlideUpMobile .3s cubic-bezier(.32,.72,0,1);
    }
    .ocip-modal-header {
        border-radius: 20px 20px 0 0;
    }
    .ocip-modal-dialog.modal-full {
        max-height: 100vh;
        border-radius: 0;
    }
    .ocip-modal-footer {
        flex-direction: column-reverse;
        border-radius: 0;
    }
    .ocip-modal-footer .btn {
        width: 100%;
        text-align: center;
    }
}

@keyframes modalSlideUpMobile {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

/* ── SCROLL INDICATOR ─────────────────────────────────────────── */
/* Fade at bottom of modal body when scrollable */
.ocip-modal-body-wrap {
    position: relative;
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ocip-modal-body-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(to bottom, transparent, rgba(255,255,255,.95));
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s;
}

.ocip-modal-body-wrap.has-scroll::after {
    opacity: 1;
}

/* ══════════════════════════════════════════════════════════════
   DRAG & DROP ZONE
   ══════════════════════════════════════════════════════════════ */
.drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafafa;
    user-select: none;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #c0392b;
    background: #fff5f5;
}

.drop-zone i {
    font-size: 2.5rem;
    color: #d1d5db;
    display: block;
    margin-bottom: .75rem;
    transition: color .2s;
}

.drop-zone:hover i,
.drop-zone.dragover i {
    color: #c0392b;
}

.drop-zone p {
    color: #6b7280;
    font-size: .9rem;
    margin: 0;
}

.drop-zone strong {
    color: #c0392b;
}

/* ══════════════════════════════════════════════════════════════
   BADGE ENHANCEMENTS
   ══════════════════════════════════════════════════════════════ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .25rem .65rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE TABLE WRAPPER
   ══════════════════════════════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
}

.table-responsive .table {
    min-width: 600px;
}

/* ══════════════════════════════════════════════════════════════
   LOADING SPINNER OVERLAY
   ══════════════════════════════════════════════════════════════ */
.ocip-loading {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.ocip-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #c0392b;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════════════════════════════
   PROGRESS BAR
   ══════════════════════════════════════════════════════════════ */
.progress-bar-wrap {
    background: #e5e7eb;
    border-radius: 20px;
    height: 8px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #c0392b, #e74c3c);
    border-radius: 20px;
    transition: width .4s ease;
}

/* ══════════════════════════════════════════════════════════════
   ADMIN NAV RESPONSIVE
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    .admin-nav .nav-links {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--primary-color, #1a1a2e);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 1.5rem;
        z-index: 4000;
    }
    .admin-nav .nav-links.open {
        display: flex;
    }
    .admin-nav .nav-links a {
        font-size: 1.1rem;
        color: #fff;
    }
    .admin-nav-toggle {
        display: flex !important;
        background: none;
        border: none;
        cursor: pointer;
        flex-direction: column;
        gap: 5px;
        padding: .5rem;
    }
    .admin-nav-toggle span {
        display: block;
        width: 24px;
        height: 2px;
        background: #fff;
        border-radius: 2px;
        transition: all .3s;
    }
}

@media (min-width: 769px) {
    .admin-nav-toggle { display: none !important; }
}
