/* Lyra the Wise - Medieval Design System */

:root {
    --gold: #d4af37;
    --gold-bright: #ffdf00;
    --dark-charcoal: #121212;
    --dark-panel: rgba(20, 20, 20, 0.85);
    --parchment: #f4e4bc;
    --ink: #2c1e16;
    --crimson: #8b0000;
    --glass: rgba(255, 255, 255, 0.05);
    --border-medieval: 2px solid var(--gold);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    object-fit: cover;
    box-shadow: 0 0 5px rgba(212, 175, 55, 0.5);
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    color: #e0e0e0;
    line-height: 1.6;
    background: var(--dark-charcoal);
    overflow: hidden;
    /* Lock scrollbar on home */
}

.medieval-theme {
    background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.85)),
        url('assets/Background.jpg');
    background-size: cover;
    background-attachment: fixed;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4,
.logo-text,
.medieval-btn {
    font-family: 'Cinzel', serif;
    letter-spacing: 1.5px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.header-logo {
    height: 75px;
    filter: drop-shadow(0 0 5px rgba(212, 175, 55, 0.3));
    transition: 0.3s;
}

.header-logo:hover {
    filter: drop-shadow(0 0 10px var(--gold));
    transform: scale(1.05);
}

/* Header & Nav */
.app-header {
    height: 85px;
    background: rgba(18, 12, 10, 0.95);
    border-bottom: 2px solid var(--gold);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    display: flex;
    width: 100%;
    justify-content: space-between;
    align-items: center;
    max-width: 1600px;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    height: 100%;
}

/* Hover Menu System */
.header-menu-container {
    position: relative;
    padding: 1rem 0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.header-dropdown-content {
    position: absolute !important;
    top: 100%;
    /* Slightly overlap for smooth hover */
    left: 0;
    min-width: 820px;
    background: #f4e4bc;
    /* Parchment */
    border: 3px double var(--gold);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    padding: 1.5rem;
    display: none;
    z-index: 2000;
    border-radius: 4px;
}

.header-menu-container:hover .header-dropdown-content {
    display: block;
    animation: slideDown 0.3s ease;
}

.dropdown-sections {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.dropdown-column h3 {
    font-family: 'Cinzel', serif;
    color: var(--crimson);
    font-size: 1rem;
    border-bottom: 1px solid rgba(139, 0, 0, 0.2);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
}

.dropdown-column .nav-btn {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    padding: 0.5rem 0.8rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--ink);
    cursor: pointer;
    transition: 0.2s;
    border-radius: 4px;
}

.dropdown-column .nav-btn:hover {
    background: rgba(212, 175, 55, 0.2);
    color: var(--crimson);
    padding-left: 1.2rem;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Character Tracker Header */
.header-center {
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.5s ease;
}

.tracker-info {
    display: flex;
    gap: 1.5rem;
    font-family: 'Cinzel', serif;
    color: var(--gold);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

#header-char-name {
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 1px;
}

#header-char-level,
#header-char-stats {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Side Menu */
.side-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
}

.menu-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.menu-content {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 600px;
    /* Wider for sections */
    box-shadow: 10px 0 50px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    padding: 5rem 3rem;
    animation: slideInLeft 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow-y: auto;
}

.menu-section {
    margin-bottom: 3rem;
}

.menu-section h3 {
    font-family: 'Cinzel', serif;
    color: var(--crimson);
    font-size: 1.4rem;
    border-bottom: 2px solid rgba(139, 0, 0, 0.2);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.menu-grid .nav-btn {
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(44, 30, 22, 0.1);
    color: var(--ink);
    padding: 0.8rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    justify-content: center;
    transition: 0.2s;
}

.menu-grid .nav-btn:hover {
    background: var(--gold);
    border-color: var(--ink);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.close-menu {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--ink);
    font-size: 2rem;
    cursor: pointer;
}

.menu-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.menu-links .nav-btn {
    text-align: left;
    width: 100%;
    color: var(--ink);
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    padding: 1rem;
    border-bottom: 1px solid rgba(44, 30, 22, 0.1);
}

.menu-links .nav-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--crimson);
}

/* Parchment Containers */
.parchment {
    background: url('https://www.transparenttextures.com/patterns/pizzelle.png'), var(--parchment);
    color: var(--ink);
    padding: 2rem;
    border-radius: 4px;
    position: relative;
    box-shadow: 10px 10px 30px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #d3c29a;
}

/* Buttons */
.medieval-btn {
    background: linear-gradient(145deg, #2c1e16, #120b08);
    border: 1px solid var(--gold);
    color: var(--gold);
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    font-weight: bold;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.medieval-btn.icon-only {
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.medieval-btn:hover {
    background: var(--gold);
    color: #000;
    box-shadow: 0 0 15px var(--gold);
}

.medieval-btn.small {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
}

/* Dashboard & View Headers */
.hero-section {
    padding: 2rem 4rem;
    /* More horizontal padding */
    max-width: 1600px;
    margin: 0 auto;
    height: calc(100vh - 85px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* New Wrapper for Side-by-Side */
/* New Wrapper for Side-by-Side */
.hero-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Centered horizontally */
    gap: 5rem;
    /* Increased gap for better spacing */
    margin-top: 2rem;
    padding: 0 2rem;
}

.hero-artwork {
    flex-shrink: 0;
    /* Don't shrink image */
}

.hero-lyra {
    max-width: 250px;
    /* Bigger image */
    width: 250px;
    height: 350px;
    /* Portrait aspect ratio */
    border-radius: 20px;
    /* Rounded rectangle instead of circle */
    object-fit: cover;
    border: 3px solid var(--gold);
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8);
}

.lyra-story {
    text-align: left;
    /* Align text left */
    max-width: 800px;
}

.lyra-story h2 {
    font-size: 2.5rem;
    /* Larger title */
    margin-bottom: 1rem;
    color: var(--gold);
    text-shadow: 0 0 10px rgba(212, 175, 55, 0.3);
}

.lyra-story p {
    font-size: 1.1rem;
    line-height: 1.6;
    opacity: 0.9;
    font-style: italic;
    color: #e0e0e0;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    padding: 1.5rem 4rem 2rem 4rem;
    /* Increased top padding */
    width: 100%;
    flex: 1;
    overflow-y: visible;
    /* CRITICAL: Allow hover scaling to not clip */
    overflow-x: hidden;
    scrollbar-width: none;
    align-content: flex-start;
    margin-top: 2rem;
    /* Spacing from story */
}

.quick-actions::-webkit-scrollbar {
    display: none;
    /* Hide scrollbar Chrome/Safari */
}

.action-card {
    background: rgba(20, 20, 20, 0.7);
    border: 2px solid rgba(212, 175, 55, 0.3);
    border-radius: 12px;
    padding: 1rem;
    width: 160px;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(15px);
    color: var(--gold);
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.4);
}

.action-card:hover {
    transform: translateY(-8px) scale(1.1);
    /* Reduced scale slightly for better fit */
    border-color: var(--gold-bright);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6), 0 0 20px rgba(212, 175, 55, 0.4);
    background: rgba(30, 30, 30, 0.9);
    z-index: 100;
    /* CRITICAL: Stay on top of neighbors */
}

.action-card i {
    font-size: 2rem;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
    transition: 0.4s;
}

.action-card:hover i {
    transform: scale(1.2) rotate(5deg);
    color: var(--gold-bright);
}

.action-card span {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 1px;
    text-align: center;
    line-height: 1.2;
}

.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.view-header h2 {
    color: var(--gold);
    font-size: 2.2rem;
}

/* Grid & Cards */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto 4rem auto;
    padding: 0 2rem;
}

.medieval-card {
    background: var(--dark-panel);
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    position: relative;
    transition: 0.3s;
    cursor: pointer;
}

.medieval-card:hover {
    border-color: var(--gold);
    transform: translateY(-8px);
}

.card-title {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 1.25rem;
}

.card-subtitle {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 1rem;
}

.card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    border-top: 1px solid rgba(212, 175, 55, 0.1);
    padding-top: 1rem;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.65rem;
    color: #666;
}

.stat-value {
    font-weight: bold;
}

/* Chat UI */
.chat-container {
    max-width: 900px;
    margin: 2rem auto;
    height: 75vh;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    /* Keep internal padding 0, move it to sub-elements */
    overflow: hidden;
    border: 3px double var(--gold);
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.6);
}

.chat-header {
    background: rgba(0, 0, 0, 0.03);
    padding: 1.5rem 2.5rem;
    border-bottom: 2px solid rgba(44, 30, 22, 0.1);
}

.chat-header h2 {
    font-size: 1.6rem;
    color: var(--ink);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.msg {
    max-width: 85%;
    padding: 1rem 1.5rem;
    border-radius: 4px;
}

.msg.bot {
    align-self: flex-start;
    background: rgba(0, 0, 0, 0.03);
    border-left: 3px solid var(--gold);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--gold);
    flex-shrink: 0;
}

.msg-content {
    line-height: 1.5;
}

.msg.user {
    align-self: flex-end;
    background: rgba(44, 30, 22, 0.05);
    text-align: right;
}

.chat-input-area {
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 1rem;
}

#chat-input {
    flex: 1;
    padding: 0.8rem;
    border-radius: 4px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Modal & Wizard */
#modal-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
}

#modal-wrapper.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
}

.modal-content {
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1001;
    position: relative;
    padding: 3rem 2rem 2rem 2rem;
}

.wizard-progress {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.step-indicator {
    width: 30px;
    height: 30px;
    border: 2px solid var(--ink);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.3;
}

.step-indicator.active {
    opacity: 1;
    background: var(--ink);
    color: var(--parchment);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-family: 'Cinzel', serif;
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid #8b4513;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.attributes-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.attr-input {
    text-align: center;
    background: rgba(0, 0, 0, 0.02);
    padding: 1rem;
}

.attr-input input {
    width: 60px;
    text-align: center;
    font-size: 1.2rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--gold);
}

.skills-selection {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.8rem;
}

.skills-selection label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.wizard-nav {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* Character Sheet (Libram) */
.sheet-container {
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 80vh;
}

.sheet-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.05);
    padding: 0.5rem;
    border-radius: 8px;
    overflow-x: auto;
}

.sheet-tab {
    background: transparent;
    border: none;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.8rem;
    color: var(--ink);
    opacity: 0.5;
    transition: 0.3s;
    white-space: nowrap;
}

.sheet-tab.active {
    opacity: 1;
    background: var(--ink);
    color: var(--parchment);
    border-radius: 4px;
}

.sheet-section {
    padding-bottom: 2rem;
}

.sheet-section h2 {
    margin-bottom: 0.5rem;
    color: #2c1e16;
}

.sheet-section p {
    color: #5a4a3a;
    font-style: italic;
    margin-bottom: 1.5rem;
}

.vital-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.vital-box {
    text-align: center;
    background: rgba(0, 0, 0, 0.03);
    padding: 1.5rem;
    border: 2px solid #8b4513;
    border-radius: 4px;
}

.vital-box span {
    display: block;
    font-size: 0.7rem;
    font-family: 'Cinzel', serif;
    margin-bottom: 0.5rem;
}

.vital-box strong {
    font-size: 1.8rem;
    color: #8b0000;
}

.scores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem;
}

.score-box {
    text-align: center;
    border: 1px solid #d3c29a;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.02);
}

.score-box .label {
    font-family: 'Cinzel', serif;
    display: block;
    margin-bottom: 0.5rem;
}

.score-box .mod {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--ink);
}

.score-box .val {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.5rem;
    display: block;
}

.text-block {
    background: rgba(0, 0, 0, 0.03);
    padding: 1.5rem;
    border-radius: 4px;
    font-size: 0.95rem;
    white-space: pre-wrap;
    line-height: 1.8;
}

.traits-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 2rem;
}

.traits-grid strong {
    display: block;
    font-family: 'Cinzel', serif;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
}

.traits-grid p {
    font-size: 0.85rem;
    font-style: normal !important;
}

.sheet-footer {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: flex-end;
}

.medieval-textarea {
    width: 100%;
    height: 120px;
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-bottom: 2px solid #8b4513;
    padding: 0.8rem;
    font-family: inherit;
    resize: vertical;
    outline: none;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
    }

    to {
        transform: translateX(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Helpers */
.hidden {
    display: none !important;
}

.error-text {
    color: var(--crimson);
    text-align: center;
    padding: 1rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    opacity: 0.6;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }

    .hero-content-wrapper {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        margin-top: 1rem;
        padding: 0;
    }

    .lyra-story {
        text-align: center;
    }

    .hero-lyra {
        width: 150px;
        height: 150px;
        border-radius: 50%;
        /* Circle on mobile */
    }
}