/* ===== RESET ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Inter", sans-serif;
}

/* ===== APP LAYOUT ===== */
body {
    background:
        radial-gradient(circle at center, rgba(95, 98, 255, 0.12) 0%, rgba(10, 11, 16, 0) 35%),
        linear-gradient(180deg, #0b0d14 0%, #07090f 100%);
    height: 100vh;
    overflow: hidden;
}

.app {
    width: 100%;
    min-height: 100vh;
    position: relative;
}

.main-content {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

.binder-wrapper {
    width: 100%;
    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);
}

/* ===== SIDEBAR ===== */
.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;
}

.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: rgb(37, 40, 207);
}

.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 SHELL ===== */
.binder-shell {
    position: relative;
    display: inline-block;
}

.binder-name-label {
    position: absolute;
    top: -45px;
    left: 1px;
    z-index: 50;
    display: inline-flex;
    align-items: center;
    max-width: 260px;
    padding: 5px 10px;
    border-radius: 8px;
    background: rgba(39, 39, 39, 0.116);
    border: 1px solid rgba(17, 16, 16, 0.486);
    box-shadow: 0 4px 7px rgba(12, 12, 12, 0.836);
    font-size: 20px;
    line-height: 1;
    font-weight: 700;
    color: #f3f5f7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.binder-name-label span {
    opacity: 0.6;
    font-weight: 500;
    margin-left: 10px;
    letter-spacing: 0.03em;
    font-size: 17px;
}

.binder-credit {
    opacity: 0.1;
    position: absolute;
    top: -35px;
    right: 10px;
    z-index: 50;
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 5px 10px;
    font-size: 13px;
    line-height: 1;
    font-weight: 300;
    color: #f3f5f7;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.kofi-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 15px;
    color: white;
    background: rgba(255, 255, 255, 0.08);
    transition: 0.18s ease;
}

.kofi-btn:hover {
    background: #fd0f0fb6;
}

/* ===== BINDER ===== */
.binder {
    display: flex;
    gap: 22px;
    padding: 16px;

    position: relative;
    overflow: hidden;

    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);
}

/* Background image layer */
.binder::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("../assets/images/bg.jpg") no-repeat center center;
    background-size: cover;
    filter: grayscale(100%);
    opacity: 0.3; /* adjust intensity */
    z-index: 0;
}

/* Dark overlay for readability */
.binder::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(10, 12, 18, 0.6);
    z-index: 1;
}

/* Keep content above */
.binder > * {
    position: relative;
    z-index: 2;
}

/* ===== 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);
    box-shadow:
    0 10px 30px rgba(0, 0, 0, 0.55),
    0 2px 6px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset;
    animation: pageFadeIn 0.18s ease;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 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 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;
    z-index: 1;
}

.slot:hover img {
    transform: scale(1.08);
}

.slot.has-card .card-glare {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    border-radius: inherit;
    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.12) 0%,
            rgba(255, 255, 255, 0.04) 14%,
            rgba(255, 255, 255, 0.01) 28%,
            rgba(255, 255, 255, 0) 48%);
    opacity: 0.55;
}

.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;
}

/* ===== EMPTY SLOT HINT ===== */
.slot-empty-hint {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-size: 50px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.18);
    opacity: 0;
    transform: scale(0.9);
    transition: 0.18s ease;
}

.slot:hover .slot-empty-hint {
    opacity: 1;
    transform: scale(1);
}

/* ===== DRAG HOVER ===== */
.slot.drag-over {
    border-color: rgb(18, 124, 97);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 0 0 1px rgba(140, 145, 255, 0.25),
        0 12px 28px rgba(0, 0, 0, 0.28);
    transform: translateY(-3px) scale(1.02);
}

.slot.drag-over::before {
    background: linear-gradient(135deg,
            rgba(140, 145, 255, 0.18) 0%,
            rgba(140, 145, 255, 0.05) 30%,
            rgba(255, 255, 255, 0.02) 100%);
}

/* ===== SLOT PRICE ===== */
.card-price {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px 8px;
    border-radius: 8px;
    background: rgba(39, 39, 39, 0.699);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgb(0, 0, 0);
    font-size: 18px;
    line-height: 1;
    font-weight: 700;
    color: #f3f5f7;
    white-space: nowrap;
}

.card-price:empty {
    display: none;
}

.price-token {
    width: 22px;
    height: 22px;
    flex: 0 0 20px;
    background-image: url("../assets/icons/token.png");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-position: center;
}

.price-value {
    display: inline-block;
    line-height: 1;
}

/* ===== SLOT ACTIONS ===== */
.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);
}

/* ===== PAGE CONTROLS ===== */
#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: 22px;
    width: 34px;
    height: 34px;
    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: 26px;
    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);
}

/* ===== NAVIGATION ===== */
.nav {
    font-size: 20px;
    background: rgba(12, 14, 22, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: #f3f5f7;
    width: 48px;
    height: 48px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background 0.18s ease,
        transform 0.18s ease,
        border-color 0.18s ease,
        box-shadow 0.18s ease,
        opacity 0.18s ease;
    z-index: 10;
    flex-shrink: 0;
    box-shadow:
        0 10px 24px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.nav:hover {
    background: rgba(95, 98, 255, 0.18);
    border-color: rgba(140, 145, 255, 0.26);
    transform: scale(1.06);
}

.page-nav {
    position: absolute;
    left: 50%;
    bottom: -68px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    z-index: 10;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(10, 12, 18, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.page-nav button {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, 0.88);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.18s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-nav button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: scale(1.05);
}

#currentPage {
    min-width: 88px;
    text-align: center;
    font-size: 13px;
    font-weight: 700;
    color: #f3f5f7;
    padding: 0 8px;
    letter-spacing: 0.02em;
}

.nav:disabled,
.page-nav button:disabled {
    opacity: 0.28;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
    box-shadow: none;
}

.nav:disabled:hover,
.page-nav button:disabled:hover {
    background: rgba(35, 37, 48, 0.9);
    color: white;
    transform: none;
}

/* ===== RESPONSIVE ===== */
@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);
    }
}