/* Reset */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Inter", sans-serif;
}

body {
    background: #0a0b10;
    color: white;
    height: 100vh;
    overflow: hidden;
}

.app {
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* Main content */
.main-content {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.binder-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 26px;
    transform: scale(0.68);
}

/* Wrapper */
.binder-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;

}

/* Sidebar INSIDE binder layout */
.sidebar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 90px;
    padding: 30px 10px;
    background: rgba(8, 10, 18, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
    flex-shrink: 0;
}

/* Icon buttons */
.tool-btn {
    width: 100px;
    height: 75px;
    border: none;
    background: transparent;
    color: #d8dbe7;
    border-radius: 12px;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.18s ease;
}

.tool-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.tool-btn.danger {
    color: #ff5a5a;
}

.tool-btn.danger:hover {
    background: rgba(255, 90, 90, 0.1);
}

.tool-divider {
    width: 30px;
    height: 1px;
    background: rgba(255, 255, 255, 0.15);
    margin: 6px 0;
}

/* ===== BINDER POPUP OVERLAY ===== */

.binder-popup-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;

    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);

    z-index: 300;
}

.binder-popup-overlay.open {
    display: flex;
}


/* ===== POPUP BOX ===== */

.binder-popup {
    width: 420px;
    max-width: 92vw;
    max-height: 82vh;

    display: flex;
    flex-direction: column;
    overflow: hidden;

    background: #11141c;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);

    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
}


/* ===== HEADER ===== */

.binder-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 16px 18px;

    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.binder-popup-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: white;
}


/* ===== CLOSE BUTTON ===== */

.close-popup-btn {
    width: 34px;
    height: 34px;

    border: none;
    border-radius: 10px;

    background: rgba(255, 255, 255, 0.06);
    color: white;

    cursor: pointer;
    transition: 0.18s ease;
}

.close-popup-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}


/* ===== BINDER LIST ===== */

.binder-popup-list {
    display: flex;
    flex-direction: column;
    gap: 8px;

    padding: 14px;

    overflow-y: auto;
}


/* ===== SCROLLBAR ===== */

.binder-popup-list::-webkit-scrollbar {
    width: 6px;
}

.binder-popup-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}


/* ===== BINDER ITEM ===== */

.binder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;

    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);

    color: white;

    cursor: pointer;
    transition: 0.18s ease;
}


/* ===== HOVER ===== */

.binder-item:hover {
    background: rgba(255, 255, 255, 0.06);
}


/* ===== ACTIVE BINDER ===== */

.binder-item.active {
    background: rgba(95, 98, 255, 0.12);
    border: 1px solid rgba(95, 98, 255, 0.25);
}


/* ===== BINDER INFO ===== */

.binder-info {
    display: flex;
    flex-direction: column;
}

.binder-item-name {
    font-size: 13px;
    font-weight: 600;
}

.binder-item-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
}


/* ===== POPUP ANIMATION ===== */

.binder-popup {
    animation: popupFade 0.18s ease;
}

@keyframes popupFade {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.binder-item {
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
    color: white;
    cursor: pointer;
    transition: 0.18s ease;
}

.binder-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.binder-item-top {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.binder-item-name {
    font-size: 13px;
    font-weight: 600;
}

.binder-item-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
}

.binder-item-badge {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    opacity: 0.85;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.binder-item.active .binder-item-badge {
    background: rgba(95,98,255,0.18);
    border-color: rgba(95,98,255,0.25);
    color: #ffffff;
}

/* Binder shell */
.binder-shell {
    position: relative;
    display: inline-block;
}

/* Binder */
.binder {
    display: flex;
    gap: 22px;
    padding: 16px;
    background: linear-gradient(180deg, #121520 0%, #0d1018 100%);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.02) inset,
        0 8px 30px rgba(0, 0, 0, 0.5);
}

/* Pages */
.page {
    display: grid;
    grid-template-columns: repeat(4, 180px);
    grid-template-rows: repeat(3, 250px);
    gap: 10px;
    padding: 14px;
    background: #0b0d15;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Slots */
.slot {
    width: 180px;
    height: 250px;
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
        rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        inset 0 0 0 1px rgba(255, 255, 255, 0.02),
        0 8px 18px rgba(0, 0, 0, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.slot::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    pointer-events: none;
    background: linear-gradient(135deg,
            rgba(255, 255, 255, 0.10) 0%,
            rgba(255, 255, 255, 0.03) 18%,
            rgba(255, 255, 255, 0.00) 45%,
            rgba(255, 255, 255, 0.04) 100%);
    opacity: 0.9;
}

.slot::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 10px;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.slot:hover {
    border-color: rgba(140, 145, 255, 0.35);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.08),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03),
        0 10px 22px rgba(0, 0, 0, 0.24);
    transform: translateY(-2px);
}

.slot:hover img {
    transform: scale(1.08);
}

.slot img {
    width: calc(100% - 10px);
    height: calc(100% - 10px);
    object-fit: cover;
    border-radius: 10px;
    position: absolute;
    top: 5px;
    left: 5px;
    display: block;
    transition: transform 0.22s ease;
    transform: scale(1);
    transform-origin: center center;
    position: absolute;
    z-index: 1;
}

.slot:empty {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
        rgba(255, 255, 255, 0.01);
}

.slot:empty::before {
    opacity: 0.65;
}

/* Arrows */
.nav {
    font-size: 22px;
    background: rgba(35, 37, 48, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.18s ease;
    z-index: 10;
    flex-shrink: 0;
}

.nav:hover {
    background: #5f62ff;
    transform: scale(1.06);
}

/* Page buttons */
#addPageBtn {
    position: absolute;
    right: 14px;
    bottom: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 26px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.18s ease;
    z-index: 10;
}

#addPageBtn:hover {
    background: rgba(95, 98, 255, 0.28);
    transform: scale(1.08);
}

#deletePageBtn {
    position: absolute;
    left: 14px;
    bottom: 14px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 24px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.18s ease;
    z-index: 10;
}

#deletePageBtn:hover {
    background: rgba(255, 0, 0, 0.15);
    transform: scale(1.08);
}

/* Page nav */
.page-nav {
    position: absolute;
    left: 50%;
    bottom: -75px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 10;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.22);
}

.page-nav button {
    background: transparent;
    border: none;
    color: white;
    font-size: 18px;
    font-weight: bold;
    min-width: 24px;
    height: 24px;
    cursor: pointer;
    transition: 0.18s ease;
}

.page-nav button:hover {
    color: #8d8fff;
    transform: scale(1.08);
}

#currentPage {
    font-size: 15px;
    min-width: 42px;
    text-align: center;
    color: #ffffff;
    font-weight: bold;
}

/* Slot action buttons */
.slot-actions {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: -1px;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 3;
}

.slot:hover .slot-actions {
    opacity: 1;
    transform: translateY(0);
}

.slot-actions button {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 7px;
    background: rgba(8, 10, 18, 0.72);
    backdrop-filter: blur(4px);
    color: white;
    font-size: 15px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.18s ease;
}

.slot-actions button:hover {
    background: rgba(95, 98, 255, 0.45);
    border-color: rgba(140, 145, 255, 0.35);
}



/* Responsive scaling */
@media (max-width: 1400px) {
    .binder-container {
        transform: scale(0.63);
    }
}

@media (max-width: 1200px) {
    .binder-container {
        transform: scale(0.58);
    }

    .page {
        grid-template-columns: repeat(4, 150px);
        grid-template-rows: repeat(3, 210px);
    }

    .slot {
        width: 150px;
        height: 210px;
    }
}

@media (max-width: 900px) {
    .binder-container {
        transform: scale(0.50);
    }
}