/* =====================================================
   LAPOZÓS RPG - Könyv & Lapozás stílusok
   ===================================================== */

/* Játék konténer */
.game-container {
    display: flex;
    gap: 30px;
    padding: 40px 30px;
    max-width: var(--container-width);
    margin: 0 auto;
    min-height: calc(100vh - var(--header-height));
    align-items: flex-start;
}

/* Könyv wrapper - perspektíva */
.book-wrapper {
    flex: 1;
    perspective: 2000px;
    display: flex;
    justify-content: center;
    padding: 40px 0;
}

/* Könyv fő elem */
.book {
    width: 800px;
    max-width: 100%;
    height: 600px;
    display: flex;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

.book:hover {
    transform: rotateY(-2deg);
}

/* Könyv gerinc */
.book-spine {
    width: 40px;
    background: linear-gradient(90deg,
        #2c1810 0%,
        #4a3020 20%,
        #3a2515 50%,
        #4a3020 80%,
        #2c1810 100%
    );
    box-shadow:
        inset 2px 0 5px rgba(0, 0, 0, 0.5),
        inset -2px 0 5px rgba(0, 0, 0, 0.5);
    border-radius: 3px;
    position: relative;
    z-index: 10;
}

.book-spine::before {
    content: '';
    position: absolute;
    top: 20px;
    bottom: 20px;
    left: 50%;
    width: 4px;
    transform: translateX(-50%);
    background: linear-gradient(180deg,
        #8b7355 0%,
        #a08060 50%,
        #8b7355 100%
    );
    border-radius: 2px;
}

/* Könyv oldalak */
.book-page {
    flex: 1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.645, 0.045, 0.355, 1);
}

.page-left {
    transform-origin: right center;
    border-radius: 5px 0 0 5px;
}

.page-right {
    transform-origin: left center;
    border-radius: 0 5px 5px 0;
}

/* Oldal tartalom */
.page-content {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 40px;
    overflow-y: auto;
    backface-visibility: hidden;
}

/* Pergamen stílus */
.book.style-parchment .page-content {
    background:
        linear-gradient(135deg,
            rgba(244, 228, 188, 0.95) 0%,
            rgba(212, 196, 156, 0.95) 100%
        ),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)' opacity='0.1'/%3E%3C/svg%3E");
    color: var(--parchment-text);
    box-shadow:
        inset 0 0 50px rgba(139, 115, 85, 0.3),
        0 5px 20px rgba(0, 0, 0, 0.3);
}

.page-left .page-content {
    box-shadow:
        inset -20px 0 30px -20px rgba(0, 0, 0, 0.2),
        0 5px 20px rgba(0, 0, 0, 0.3);
}

.page-right .page-content {
    box-shadow:
        inset 20px 0 30px -20px rgba(0, 0, 0, 0.2),
        0 5px 20px rgba(0, 0, 0, 0.3);
}

/* Modern stílus */
.book.style-modern .page-content {
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
    color: #333;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

/* Sötét stílus */
.book.style-dark .page-content {
    background: linear-gradient(135deg, #1e1e2e 0%, #2d2d3d 100%);
    color: #e0e0e0;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 0 60px rgba(0, 0, 0, 0.3);
}

/* Fantasy stílus */
.book.style-fantasy .page-content {
    background:
        linear-gradient(135deg,
            rgba(40, 30, 60, 0.95) 0%,
            rgba(60, 40, 80, 0.95) 100%
        );
    color: #d4c4a8;
    box-shadow:
        0 10px 40px rgba(100, 50, 150, 0.3),
        inset 0 0 100px rgba(150, 100, 200, 0.1);
    border: 1px solid rgba(150, 100, 200, 0.2);
}

/* Sci-fi stílus */
.book.style-scifi .page-content {
    background: linear-gradient(135deg, #0a1628 0%, #1a2a48 100%);
    color: #00ff88;
    font-family: 'Courier New', monospace;
    box-shadow:
        0 10px 40px rgba(0, 255, 136, 0.1),
        inset 0 0 80px rgba(0, 100, 200, 0.1);
    border: 1px solid rgba(0, 255, 136, 0.2);
}

/* Oldal szám */
.page-number {
    position: absolute;
    bottom: 20px;
    font-family: var(--font-display);
    font-size: 1rem;
    color: rgba(0, 0, 0, 0.4);
}

.page-left .page-number {
    left: 40px;
}

.page-right .page-number {
    right: 40px;
}

/* Oldal tartalom elemek */
.page-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 25px;
    color: inherit;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

.page-text {
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.8;
    text-align: justify;
    margin-bottom: 25px;
}

.page-text::first-letter {
    font-size: 3rem;
    font-family: var(--font-display);
    float: left;
    line-height: 1;
    margin-right: 10px;
    margin-top: 5px;
    color: var(--color-primary);
}

.page-image {
    width: 100%;
    max-height: 250px;
    object-fit: cover;
    border-radius: 8px;
    margin: 20px 0;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.page-video {
    width: 100%;
    border-radius: 8px;
    margin: 20px 0;
}

/* Választási lehetőségek */
.page-choices {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid rgba(0, 0, 0, 0.1);
}

.choice-btn {
    display: block;
    width: 100%;
    padding: 15px 20px;
    margin-bottom: 12px;
    background: rgba(0, 0, 0, 0.05);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    text-align: left;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 1rem;
    color: inherit;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.choice-btn::before {
    content: '→';
    position: absolute;
    left: 15px;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.choice-btn:hover {
    background: rgba(233, 69, 96, 0.1);
    border-color: var(--color-primary);
    padding-left: 40px;
}

.choice-btn:hover::before {
    opacity: 1;
    transform: translateX(0);
}

.choice-btn.dice-check::after {
    content: '🎲';
    position: absolute;
    right: 15px;
    font-size: 1.2rem;
}

.choice-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.choice-btn:disabled:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    padding-left: 20px;
}

/* HP/Gold változás jelzés */
.stat-change {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 5px;
}

.stat-change.positive {
    background: rgba(46, 213, 115, 0.2);
    color: var(--color-success);
}

.stat-change.negative {
    background: rgba(255, 71, 87, 0.2);
    color: var(--color-danger);
}

/* Tárgy kapás jelzés */
.item-received {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 12px 20px;
    border-radius: 10px;
    margin: 15px 0;
}

.item-received-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.item-received-text {
    font-weight: 500;
}

/* Lapozás animáció */
.book-page.flipping {
    animation: pageFlip 0.8s ease-in-out;
}

@keyframes pageFlip {
    0% {
        transform: rotateY(0deg);
    }
    50% {
        transform: rotateY(-90deg);
    }
    100% {
        transform: rotateY(-180deg);
    }
}

.page-left.flip-out {
    transform: rotateY(-180deg);
}

.page-right.flip-in {
    transform: rotateY(0deg);
}

/* Oldalváltás effekt */
.page-transition {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.3) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.book-page:hover .page-transition {
    opacity: 1;
}

/* Ending oldalak */
.page-ending {
    text-align: center;
}

.page-ending.win .page-title {
    color: var(--color-success);
}

.page-ending.win .page-content::before {
    content: '🏆';
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
}

.page-ending.lose .page-title {
    color: var(--color-danger);
}

.page-ending.lose .page-content::before {
    content: '💀';
    font-size: 4rem;
    display: block;
    margin-bottom: 20px;
}

/* Karakter panel */
.character-panel {
    width: 280px;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 25px;
    position: sticky;
    top: calc(var(--header-height) + 20px);
}

.char-portrait {
    width: 120px;
    height: 120px;
    margin: 0 auto 15px;
    border-radius: 50%;
    border: 3px solid var(--color-primary);
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-secondary), var(--color-accent));
}

.char-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.char-name {
    font-family: var(--font-display);
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 5px;
}

.char-level {
    text-align: center;
    color: var(--color-gold);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.char-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin: 20px 0;
}

.stat {
    text-align: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.stat-icon {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 5px;
}

.stat-value {
    font-weight: 600;
    font-size: 1.1rem;
}

.btn-inventory,
.btn-save {
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: var(--color-text);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-inventory:hover,
.btn-save:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

/* Inventory panel */
.inventory-panel {
    width: 600px;
}

.inventory-panel h2 {
    font-family: var(--font-display);
    margin-bottom: 25px;
    color: var(--color-primary);
}

.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.inventory-slot {
    aspect-ratio: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    position: relative;
}

.inventory-slot:hover {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.inventory-slot.equipped {
    border-color: var(--color-gold);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3);
}

.inventory-slot img {
    width: 60%;
    height: 60%;
    object-fit: contain;
}

.inventory-slot .item-count {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.7);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.inventory-slot .item-name {
    font-size: 0.7rem;
    text-align: center;
    margin-top: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    padding: 0 5px;
}

/* Save panel */
.save-panel {
    width: 500px;
}

.save-panel h2 {
    font-family: var(--font-display);
    margin-bottom: 25px;
    color: var(--color-primary);
}

.save-slots {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.save-slot {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: var(--transition-fast);
}

.save-slot:hover {
    border-color: var(--color-primary);
}

.save-slot-number {
    width: 40px;
    height: 40px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.save-slot-info {
    flex: 1;
}

.save-slot-name {
    font-weight: 500;
    margin-bottom: 3px;
}

.save-slot-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.save-slot-actions {
    display: flex;
    gap: 8px;
}

.save-slot-btn {
    padding: 8px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition-fast);
}

.save-slot-btn.save {
    background: var(--color-primary);
    color: white;
}

.save-slot-btn.load {
    background: rgba(46, 213, 115, 0.2);
    color: var(--color-success);
}

.save-slot-btn.delete {
    background: rgba(255, 71, 87, 0.2);
    color: var(--color-danger);
}

.save-slot-btn:hover {
    transform: scale(1.05);
}

/* Empty slot */
.save-slot.empty {
    opacity: 0.5;
}

.save-slot.empty .save-slot-name {
    color: var(--color-text-muted);
    font-style: italic;
}

/* Reszponzív */
@media (max-width: 1200px) {
    .book {
        width: 600px;
        height: 500px;
    }

    .page-content {
        padding: 30px;
    }
}

@media (max-width: 900px) {
    .game-container {
        flex-direction: column;
    }

    .character-panel {
        width: 100%;
        position: relative;
        top: 0;
        order: -1;
    }

    .book {
        width: 100%;
        height: auto;
        min-height: 400px;
        flex-direction: column;
    }

    .book-spine {
        width: 100%;
        height: 15px;
    }

    .page-left,
    .page-right {
        min-height: 300px;
    }
}
