/* =========================================================
   IMAGES TO PDF - STYLES (matching your pattern)
   ========================================================= */

/* === RESET & BASE === */
.i2p-module *,
.i2p-module *::before,
.i2p-module *::after {
    box-sizing: border-box;
}

/* === UPLOAD ZONE === */
.i2p-upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    background: var(--bs-body-bg, #fff);
    transition: border-color .2s, background .2s;
    cursor: pointer;
}

    .i2p-upload-zone:hover,
    .i2p-upload-zone.i2p-drag-over {
        border-color: #00924A;
        background: rgba(0,146,74,.04);
    }

/* === IMAGE CARD === */
.i2p-img-card {
    background: var(--bs-tertiary-bg, #f8f9fa);
    border-radius: 14px;
    border: 1px solid var(--bs-border-color, #e9ecef);
    position: relative;
    overflow: hidden;
    transition: box-shadow .2s, border-color .2s;
    cursor: pointer;
}

    .i2p-img-card:hover {
        box-shadow: 0 2px 12px rgba(0,0,0,.08);
    }

    .i2p-img-card.selected {
        border-color: #00924A;
        box-shadow: 0 0 0 2px rgba(0,146,74,0.2);
    }

    .i2p-img-card.dragging {
        opacity: 0.5;
    }

    .i2p-img-card.drag-over {
        border-color: #198754;
        background: rgba(25,135,84,.05);
    }

/* === IMAGE PREVIEW === */
.i2p-img-preview {
    position: relative;
    width: 100%;
    padding-top: 100%;
    background: var(--bs-body-bg, #fff);
    overflow: hidden;
    border-bottom: 2px dashed #607D8B;
}

    .i2p-img-preview img {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

/* === SELECTION OVERLAY === */
.i2p-select-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity .2s;
}

.i2p-img-card:hover .i2p-select-overlay,
.i2p-img-card.selected .i2p-select-overlay {
    opacity: 1;
}

.i2p-check-circle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(0,0,0,.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    transition: all .2s;
}

.i2p-img-card.selected .i2p-check-circle {
    background: #00924A;
    border-color: #00924A;
}

/* === PAGE NUMBER === */
.i2p-page-number {
    position: absolute;
    bottom: 6px;
    left: 6px;
    background: rgba(0,0,0,.6);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* === IMAGE INFO === */
.i2p-img-info {
    padding: 10px 14px;
}

.i2p-img-name {
    font-weight: 600;
    color: var(--bs-body-color);
    font-size: 13px;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.i2p-img-size {
    font-size: 11px;
    color: var(--bs-secondary-color);
    margin-bottom: 8px;
}

/* === ACTION BUTTONS === */
.i2p-img-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

.i2p-icon-btn {
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #e2e8f0);
    width: 36px;
    height: 36px;
    border-radius: 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s, background .15s;
    font-size: 17px;
    position: relative;
    flex-shrink: 0;
}

    .i2p-icon-btn:hover {
        transform: translateY(-2px);
        background: var(--bs-secondary-bg, #f1f5f9);
    }

.i2p-icon-btn-sm {
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color, #e2e8f0);
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .15s, background .15s;
    font-size: 14px;
    position: relative;
    flex-shrink: 0;
}

    .i2p-icon-btn-sm:hover {
        transform: translateY(-2px);
        background: var(--bs-secondary-bg, #f1f5f9);
    }

.i2p-drag-handle {
    cursor: grab;
    color: #94a3b8;
}

    .i2p-drag-handle:active {
        cursor: grabbing;
    }

/* === STICKY TOP BAR === */
.i2p-top-bar {
    position: sticky;
    top: 63px;
    z-index: 100;
    padding: 10px 0;
    background: #f2f2f2;
    border-bottom: 1px solid var(--bs-border-color);
    margin-bottom: 16px;
}

/* === GLOBAL PROGRESS BAR === */
.i2p-global-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 9999;
    display: none;
}

.i2p-global-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width .3s;
}

/* === TOAST === */
.i2p-toast-stack {
    position: fixed;
    top: 65px;
    right: 16px;
    z-index: 9999999 !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.i2p-toast {
    background: var(--bs-body-bg, #fff);
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    padding: 10px 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,.12);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    animation: i2p-slidein .25s ease;
    pointer-events: auto;
    min-width: 220px;
    max-width: 340px;
}

@keyframes i2p-slidein {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes i2p-slideout {
    to {
        transform: translateX(110%);
        opacity: 0;
    }
}

/* === ORIENTATION BUTTONS === */
.i2p-orient-btn {
    transition: all .15s;
}

    .i2p-orient-btn.active {
        background: #00924A;
        color: #fff;
        border-color: #00924A;
    }

/* === CREATE PDF MODAL === */
#i2p-create-modal .modal-content {
    border-radius: 14px;
    border: 1px solid var(--bs-border-color);
}

#i2p-create-modal .modal-header {
    border-bottom: 1px solid var(--bs-border-color);
}

#i2p-create-modal .modal-footer {
    border-top: 1px solid var(--bs-border-color);
}

/* === IMAGE PREVIEW MODAL === */
#i2p-preview-modal .modal-content {
    border-radius: 14px;
}

#i2p-preview-img {
    border-radius: 8px;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .i2p-card-item {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .i2p-top-bar {
        top: 0;
        padding: 8px 0;
    }

        .i2p-top-bar .d-flex.gap-2 {
            gap: 4px !important;
        }

    /* Make Create PDF button smaller on mobile */
    #i2p-create-pdf-btn {
        font-size: 12px;
        padding: 6px 10px;
        white-space: nowrap;
    }

        #i2p-create-pdf-btn i {
            font-size: 13px;
        }

    /* Make top bar buttons smaller on mobile */
    .i2p-top-bar .btn-sm {
        font-size: 11px;
        padding: 4px 8px;
    }

    .i2p-top-bar .i2p-icon-btn {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }

    #i2p-sel-all-btn,
    #i2p-desel-all-btn {
        font-size: 11px;
        padding: 4px 6px;
    }

    /* Hide text on very small screens, show icons only */
    @media (max-width: 480px) {
        #i2p-create-pdf-btn span {
            display: inline;
        }

        #i2p-create-pdf-btn {
            font-size: 11px;
            padding: 5px 8px;
        }

        .i2p-card-item {
            flex: 0 0 100%;
            max-width: 100%;
        }

        .i2p-top-bar .btn-sm {
            padding: 4px 6px;
        }
    }
}

/* === SCROLLBAR === */
.i2p-module ::-webkit-scrollbar {
    width: 6px;
}

.i2p-module ::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 6px;
}

/* === DARK MODE === */
[data-bs-theme="dark"] .i2p-img-card {
    background: var(--bs-tertiary-bg);
}

    [data-bs-theme="dark"] .i2p-img-card.selected {
        border-color: #198754;
    }

[data-bs-theme="dark"] .i2p-top-bar {
    background: var(--bs-body-bg);
}

[data-bs-theme="dark"] .i2p-orient-btn.active {
    background: #198754;
    border-color: #198754;
}
