﻿:root {
    --primary-color: #81d4fa;
    /* Light Blue for dark mode */
    --accent-color: #81d4fa;
    /* Switched from Cyan to Light Blue */
    --accent-light: #16242d;
    /* Dark Blue background instead of Dark Teal */
    --defense-silver: #b0bec5;
    --text-main: #e0e0e0;
    --text-muted: #9e9e9e;
    --bg-app: #121212;
    --card-bg: #1e1e1e;
    --input-bg: #2c2c2c;
    --border-color: #333;
    --border-radius: 12px;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.4);
    --font-heading: 'Cinzel', serif;
    --font-body: 'Lato', sans-serif;
    /* Magic Schools Colors (Muted/Earthy) */
    --school-abjuration: #90a4ae;
    /* Blue Grey */
    --school-conjuration: #a5d6a7;
    /* Green */
    --school-divination: #b39ddb;
    /* Deep Purple */
    --school-enchantment: #f48fb1;
    /* Pink */
    --school-evocation: #ef9a9a;
    /* Red (Muted) */
    --school-illusion: #ce93d8;
    /* Purple */
    --school-necromancy: #bcaaa4;
    /* Brownish */
    --school-transmutation: #ffe082;
    /* Amber */
    --school-universal: #eeeeee;
    /* Grey */
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-app);
    color: var(--text-main);
    margin: 0;
    -webkit-tap-highlight-color: transparent;
    /* Rimuove il flash azzurro predefinitivo dei browser mobili */
    padding: 10px 10px calc(54px + env(safe-area-inset-bottom, 0px)) 10px;
    /* Spazio per la nav ridotta */
    min-height: 100vh;
    box-sizing: border-box;
}


body.modal-open {
    overflow: hidden;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    padding-top: 80px;
    /* Spazio per la Top Bar aumentato */
}

/* Fixed Top Bar */
.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 15px;
    box-sizing: border-box;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
    z-index: 4000;
}

.top-bar-saves {
    display: flex;
    gap: 10px;
    flex: 1;
    justify-content: center;
}

.save-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    gap: 4px;
    align-items: center;
}

.save-btn span {
    color: var(--accent-color);
    font-size: 0.9rem;
}

.save-btn:active {
    background: var(--accent-light);
    transform: scale(0.95);
}

/* Sidebar Toggle & CD Button */
.sidebar-toggle-btn,
.cd-toggle-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.sidebar-toggle-btn:active,
.cd-toggle-btn:active {
    transform: scale(0.9);
    color: var(--accent-color);
}

/* Sidebar & Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 6000;
    backdrop-filter: blur(4px);
    transition: opacity 0.3s ease;
}

.sidebar-overlay.hidden {
    display: none;
    opacity: 0;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100%;
    background: var(--bg-app);
    z-index: 6500;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border-color);
    box-shadow: 10px 0 25px rgba(0, 0, 0, 0.5);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
}

.sidebar-header {
    padding: 25px 20px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin: 0;
}

.sidebar-actions {
    display: flex;
    gap: 10px;
}

.sidebar-action-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-action-btn:hover {
    color: var(--accent-color);
}

.sidebar-scrollable {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
}

.sidebar-item {
    background: var(--card-bg);
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-item.active {
    border-color: var(--accent-color);
    background: var(--accent-light);
    box-shadow: inset 0 0 15px rgba(129, 212, 250, 0.05);
}

.char-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.char-name {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    color: var(--text-main);
    letter-spacing: 1px;
}

.theme-trigger {
    width: 14px;
    height: 14px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-color);
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.2s;
}

.theme-trigger:hover {
    transform: scale(1.2);
}

/* Group Headers */
.party-group {
    margin-bottom: 20px;
}

.party-title {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 8px 5px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 4px;
}

.theme-selector {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 10px 0;
}

.color-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
}

.color-dot:hover {
    transform: scale(1.2);
    z-index: 2;
}

.color-dot.active {
    border-color: white;
    transform: scale(1.1);
    box-shadow: 0 0 10px currentColor;
}

.color-dot.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 10px;
    color: white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.sidebar-footer p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 5px 0;
}

.version-tag {
    font-size: 0.65rem;
    color: var(--accent-color);
    font-weight: bold;
    opacity: 0.6;
}


.main-header {
    text-align: center;
    margin-bottom: 15px;
}

.main-header h1 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    margin: 0;
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Settings Panel */
.settings-panel {
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    gap: 15px;
    align-items: flex-end;
    margin-bottom: 20px;
    flex-wrap: wrap;
    border: 1px solid var(--border-color);
}

.setting-group {
    flex: 1;
    min-width: 140px;
}

.setting-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.setting-group input {
    width: 100%;
    /* Full width for mobile friendliness */
    max-width: 80px;
    padding: 12px;
    /* Larger touch target */
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 1rem;
    font-family: var(--font-body);
    transition: border-color 0.3s;
}

.setting-group input:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* Metamagic Settings */
.metamagic-settings-container {
    width: 100%;
    margin-top: 15px;
    border-top: 1px solid var(--border-color);
    padding-top: 15px;
}

.section-label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.known-metamagic-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.known-mm-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--input-bg);
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-main);
    cursor: pointer;
}

.known-mm-item input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
}

.known-mm-item .mm-icon {
    color: var(--accent-color);
    font-size: 0.95rem;
}

.actions {
    width: 100%;
    margin-top: 10px;
}

.btn-secondary {
    width: 100%;
    /* Full width on mobile */
    padding: 12px;
    background: transparent;
    border: 1px solid var(--defense-silver);
    color: var(--defense-silver);
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    background: rgba(3, 218, 198, 0.1);
}

/* Operational Panel (Spells View) */
.operational-panel {
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.main-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 15px;
}

@media (max-width: 480px) {
    .main-actions {
        flex-direction: column;
        gap: 8px;
    }
}

.btn-primary-action,
.btn-secondary-action {
    flex: 1;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-transform: uppercase;
    transition: all 0.3s;
}

.btn-primary-action {
    background: var(--primary-color);
    color: #121212;
    border: none;
}

.btn-secondary-action {
    background: transparent;
    border: 1px solid #e57373;
    color: #e57373;
}

.btn-secondary-action:hover {
    background: rgba(229, 115, 115, 0.1);
}

.search-flex {
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 50;
}


.open-modal-btn {
    background: var(--accent-color);
    color: black;
    border: none;
    border-radius: 50%;
    width: 36px;
    /* Larger touch target */
    height: 36px;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background 0.2s;
    padding-bottom: 2px;
}

.open-modal-btn:hover {
    background: #4dd0e1;
}

/* Prepared Spells List */
.prepared-spells-list {
    padding: 10px 15px;
    min-height: 10px;
}

.prepared-spell-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: var(--input-bg);
    margin-bottom: 8px;
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
    animation: fadeIn 0.3s ease;
}

.prepared-spell-item.used {
    background: #1a1a1a;
    border-left-color: #555;
    opacity: 0.6;
}

.prepared-spell-item.used .spell-name {
    text-decoration: line-through;
    color: var(--text-muted);
}

.spell-content {
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
    /* Prevent text overflow */
}

.spell-used-toggle {
    width: 20px;
    height: 20px;
    cursor: pointer;
    background: var(--input-bg);
    border: 1px solid var(--defense-silver);
    appearance: none;
    /* Custom checkbox style if needed, but standard is okay for now */
    border-radius: 3px;
    display: grid;
    place-content: center;
}

.spell-used-toggle::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em var(--accent-color);
    transform-origin: center;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.spell-used-toggle:checked::before {
    transform: scale(1);
    background-color: var(--accent-color);
}

.spell-used-toggle:checked {
    border-color: var(--accent-color);
}


.spell-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
    /* Enable text truncation */
}

.spell-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.meta-tags {
    font-size: 0.75rem;
    color: #ffb74d;
    /* Orange lighten-2 */
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prepared-spell-item .remove-spell {
    cursor: pointer;
    color: #e57373;
    /* Red lighten-2 */
    font-weight: bold;
    padding: 5px 10px;
    /* Larger area */
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 1.4rem;
}

.prepared-spell-item .remove-spell:hover {
    opacity: 1;
}

/* Domain Slot Integration */
.domain-slot-container {
    margin-top: 12px;
    padding: 0;
    background: transparent;
    border: none;
}

.domain-fieldset {
    position: relative;
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius);
    margin: 10px 0 0 0;
    padding: 18px 15px 12px;
    background: rgba(3, 218, 198, 0.03);
    transition: all 0.3s ease;
}

.domain-legend {
    position: absolute;
    top: 0;
    left: 15px;
    transform: translateY(-50%);
    background: var(--card-bg);
    padding: 0 8px;
    color: var(--accent-color);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.05rem;
    text-transform: uppercase;
}

.domain-spell-item {
    width: 100%;
    margin: 0 !important;
    background: var(--input-bg) !important;
    border: none !important;
    border-left: 3px solid var(--accent-color) !important;
}

.domain-full-action-btn {
    width: 100%;
    height: 44px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(3, 218, 198, 0.3);
    color: var(--accent-color);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.domain-full-action-btn:hover {
    background: rgba(3, 218, 198, 0.1);
    border-color: var(--accent-color);
}

.domain-select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 0.95rem;
}

.domain-used-toggle {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-left: auto;
    accent-color: var(--accent-color);
}

.domain-full-action-btn {
    width: 100%;
    min-height: 48px;
    /* Matches standard item height with padding */
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(3, 218, 198, 0.3);
    color: var(--accent-color);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

.domain-full-action-btn:hover {
    background: rgba(3, 218, 198, 0.1);
    border-color: var(--accent-color);
    box-shadow: 0 0 10px rgba(3, 218, 198, 0.1);
}

.domain-spell-item {
    width: 100%;
    border: none !important;
    /* Remove internal border as fieldset already has one */
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
}


/* --- MODAL STYLES --- */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 7000;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(4px);
    /* 15 marginal, then 56px bottom nav */
    padding: 15px 15px calc(56px + env(safe-area-inset-bottom, 15px)) 15px;
    box-sizing: border-box;
}


.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    height: 85vh;
    /* Slightly taller on mobile */
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
    border: 1px solid var(--border-color);
}

.modal-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #252525;
}

.modal-header h2 {
    margin: 0;
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-size: 1.2rem;
}

.modal-close_btn {
    background: none;
    border: none;
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0 10px;
}

.modal-close_btn:hover {
    color: #e57373;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--accent-color);
    color: #121212;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: bold;
    font-size: 0.9rem;
    z-index: 8000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #121212;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* Custom PNG Icons Styling */
.nav-icon-img {
    width: 21px;
    /* RIDOTTO per combaciare con icone FontAwesome */
    height: 21px;
    object-fit: contain;
    /* Convert to gray #9e9e9e instead of pure white */
    filter: brightness(0) invert(62%);
    margin-bottom: 3px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.section-icon-img {
    width: 18px;
    /* Più piccola per allinearsi meglio */
    height: 18px;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(86%) sepia(34%) saturate(750%) hue-rotate(170deg) brightness(101%) contrast(100%);
    vertical-align: middle;
    margin-right: 8px;
}

.nav-item.active .nav-icon-img {
    /* Colore Azzurro (--primary-color: #81d4fa) */
    filter: brightness(0) saturate(100%) invert(86%) sepia(34%) saturate(750%) hue-rotate(170deg) brightness(101%) contrast(100%);
}

/* Sticky top section inside modal content */
.modal-sticky-section {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 15px;
    flex: 0 0 auto;
    z-index: 10;
}

.metamagic-container {
    margin-bottom: 15px;
}

.mm-label {
    color: var(--text-muted);
    font-weight: bold;
    font-size: 0.9rem;
}

.metamagic-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.mm-option {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.85rem;
    background: var(--input-bg);
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.mm-option:hover {
    background: #333;
}

.mm-option input:checked+span {
    color: var(--accent-color);
    font-weight: bold;
}

/* Search bar inside modal */
.search-bar-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

.spell-search {
    flex: 1;
    padding: 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    color: var(--text-main);
    font-family: var(--font-body);
}

.spell-search:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* Scrollable List */
.modal-spell-list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 15px;
    background: var(--card-bg);
}

.spell-grid {
    display: grid;
    grid-template-columns: 1fr;
    /* Single column default for mobile */
    gap: 10px;
}

.spell-selection-item {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: var(--text-main);
    min-height: 54px;
    /* Uniform height for aesthetics */
    gap: 10px;
}

.spell-selection-item .spell-name {
    white-space: normal;
    line-height: 1.2;
    flex: 1;
    display: block;
    word-break: break-word;
}

.spell-selection-item:hover {
    border-color: var(--accent-color);
    background: rgba(3, 218, 198, 0.05);
}

.spell-selection-item span {
    font-weight: 500;
}

.spell-selection-item .plus-icon {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 1.4rem;
}

.domain-highlight {
    color: var(--primary-color);
}

/* Favorite Styles */
.filter-favorite-btn {
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 46px;
    /* Match search input height */
    box-sizing: border-box;
}

.filter-favorite-btn i {
    font-size: 1.2rem;
}

.filter-favorite-btn.active {
    border-color: #f1c40f;
    color: #f1c40f;
    background: rgba(241, 196, 15, 0.1);
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.2);
}

.favorite-star {
    margin-right: 12px;
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.favorite-star:hover {
    transform: scale(1.2);
    color: rgba(241, 196, 15, 0.4);
}

.favorite-star.active {
    color: #f1c40f;
    text-shadow: 0 0 8px rgba(241, 196, 15, 0.5);
}

.spell-selection-item {
    padding-left: 8px !important;
    /* Adjust for star */
}

/* Domain Source Tags */
.source-tag-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 21px;
    height: 21px;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 900;
    margin-left: 10px;
    vertical-align: middle;
    line-height: 1;
    background-color: transparent;
    border: 2px solid currentColor;
}

.source-tag-icon.air {
    color: #81d4fa;
}

.source-tag-icon.travel {
    color: #4fc3f7;
}

.source-air-text {
    color: #81d4fa !important;
}

.source-travel-text {
    color: #4fc3f7 !important;
}

/* --- ANIMATIONS --- */

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

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


/* --- SPELL DETAIL MODAL --- */
.detail-modal-content {
    background: #1e1e1e;
    border: 1px solid #333;
}

.detail-header {
    background: #2c2c2c;
    border-bottom: 2px solid #333;
}

.school-tag {
    font-size: 0.8rem;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 5px;
    display: inline-block;
}

.detail-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    margin-bottom: 15px;
    border-radius: 8px;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 6px;
}

.stat-icon {
    font-size: 1.2rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-value {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-main);
}

.detail-description-container {
    padding: 0 15px 15px;
}

.detail-description-container h3 {
    color: var(--primary-color);
    font-size: 1.1rem;
    border-bottom: 1px solid #333;
    padding-bottom: 5px;
    margin-top: 0;
}

.detail-description-container p {
    line-height: 1.6;
    color: #ccc;
    white-space: pre-wrap;
}

/* School Borders classes */
.school-border-Abjuration {
    border-left-color: var(--school-abjuration) !important;
}

.school-border-Conjuration {
    border-left-color: var(--school-conjuration) !important;
}

.school-border-Divination {
    border-left-color: var(--school-divination) !important;
}

.school-border-Enchantment {
    border-left-color: var(--school-enchantment) !important;
}

.school-border-Evocation {
    border-left-color: var(--school-evocation) !important;
}

.school-border-Illusion {
    border-left-color: var(--school-illusion) !important;
}

.school-border-Necromancy {
    border-left-color: var(--school-necromancy) !important;
}

.school-border-Transmutation {
    border-left-color: var(--school-transmutation) !important;
}

.school-border-Universal {
    border-left-color: var(--school-universal) !important;
}

/* Interactive/Clickable Name */
.spell-name-clickable {
    cursor: pointer;
    text-decoration: none;
    color: var(--text-main);
    transition: color 0.2s;
}

.spell-name-clickable:hover {
    color: var(--accent-color);
}

.spell-name-clickable.slots-info.full {
    color: var(--accent-color);
}

/* Orison Usage Controls (Next to Title) */
.orison-usage-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 4px;
    border-radius: 15px;
    margin-left: 10px;
}

.orison-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: var(--accent-color);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.2s;
    line-height: 1;
}

.orison-btn:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.orison-count-display {
    font-size: 0.95rem;
    font-weight: bold;
    min-width: 40px;
    text-align: center;
}

/* Orison Premium Grid */
.prepared-orisons-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 15px;
}

.orison-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 12px 15px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.orison-card:hover {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
}

.orison-name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
}

/* --- DRAG & DROP (Placeholder styles) --- */
.detail-sources-list {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.source-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    /* Match stat-box */
    padding: 10px 14px;
    border-radius: 6px;
    cursor: default;
    color: var(--text-main);
    /* Default White */
    font-size: 0.95rem;
    border: 1px solid transparent;
}

.source-btn.source-blue .source-text {
    color: #4fc3f7 !important;
    /* Blue text for special standard adds */
    font-weight: bold;
}

.source-text {
    flex: 1;
}

.source-add-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 1.2rem;
    line-height: 1;
    /* Center vertically */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 10px;
    transition: background 0.2s;
    padding-bottom: 2px;
    /* Visual tweak */
}

.source-add-btn:hover {
    background: var(--primary-light);
}


/* Icon adjustments */
.stat-icon {
    display: flex;
    /* Center icon */
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    width: 30px;
}

.source-add-btn i {
    font-size: 0.9em;
}



/* Grid Layout for Stats */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 1rem;
}

/* Icon Colors */
.stat-box:nth-child(1) .stat-icon i {
    color: #fbc02d;
}

/* Cast Time - Gold */
.stat-box:nth-child(2) .stat-icon i {
    color: #4fc3f7;
}

/* Components - Light Blue */
.stat-box:nth-child(3) .stat-icon i {
    color: #66bb6a;
}

/* Range - Green */
.stat-box:nth-child(4) .stat-icon i {
    color: #ab47bc;
}

/* Duration - Purple */
.stat-box:nth-child(5) .stat-icon i {
    color: #ef5350;
}

/* Save - Red */
.stat-box:nth-child(6) .stat-icon i {
    color: #ec407a;
}

/* SR - Pink */

/* Make stat boxes slightly more compact for grid */
.stat-box {
    padding: 8px 10px;
}



/* --- FIXED LAYOUT & COMPACT UI CONSOLIDATED --- */

/* 1. Modal Fixed Height & Scroll Structure */
.detail-modal-content {
    display: flex;
    flex-direction: column;
    height: 85vh;
    max-height: 800px;
    padding: 0;
    overflow: hidden;
}

.detail-header {
    flex-shrink: 0;
    padding: 15px 20px 5px 20px !important;
    /* Compact Padding */
}

.detail-header h2 {
    margin-bottom: 4px;
    font-size: 1.3rem;
}

/* 2. Stats Grid (Fixed Top) */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 0 20px 10px 20px !important;
    margin-bottom: 0;
    flex-shrink: 0;
}

.stat-box {
    padding: 6px 8px !important;
    /* Compact Box */
    display: flex;
    align-items: center;
}

.stat-icon {
    width: 24px !important;
    font-size: 1rem !important;
    display: flex;
    justify-content: center;
    margin-right: 8px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.7rem !important;
    text-transform: uppercase;
    color: var(--text-muted);
}

.stat-value {
    font-size: 0.85rem !important;
    font-weight: 500;
}

/* Icon Colors */
.stat-box:nth-child(1) .stat-icon i {
    color: #fbc02d;
}

/* Time */
.stat-box:nth-child(2) .stat-icon i {
    color: #4fc3f7;
}

/* Comp */
.stat-box:nth-child(3) .stat-icon i {
    color: #66bb6a;
}

/* Range */
.stat-box:nth-child(4) .stat-icon i {
    color: #ab47bc;
}

/* Dur */
.stat-box:nth-child(5) .stat-icon i {
    color: #ef5350;
}

/* Save */
.stat-box:nth-child(6) .stat-icon i {
    color: #ec407a;
}

/* SR */

/* 3. Scrollable Body */
.detail-scroll-area {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.detail-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.detail-scroll-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* 4. Sources Footer (Fixed Bottom) */
.detail-sources-list {
    flex-shrink: 0;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px 20px 15px 20px !important;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    margin: 0;
}

/* Source Button Styling */
.source-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Push content apart */
    align-items: center;
    text-align: center;
    padding: 8px 6px !important;
    min-height: 85px;
    /* Fixed height for consistency */
}

.source-text {
    font-size: 0.75rem;
    line-height: 1.2;
    margin-bottom: 4px;
    /* Spacer */
}

.source-text i {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 6px;
    color: var(--text-muted);
}

.source-btn.source-blue .source-text i {
    color: #4fc3f7;
}

.source-add-btn {
    width: 100%;
    margin-top: auto;
    /* Push to bottom */
    padding: 4px 0;
    font-size: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* [Step 527] Final Header Spacing Adjustment */
.detail-header {
    padding-bottom: 25px !important;
    /* Significant separation */
    margin-bottom: 5px;
    /* Physical gap */
    border-bottom: 1px solid var(--border-color);
}

.stats-grid {
    padding-top: 15px !important;
    /* Breathing room for top row stats */
    border-top: none;
    /* Avoid double borders if header has one */
}

/* Global Search Results Dropdown */
.global-search-container {
    position: relative;
    /* Anchor for absolute dropdown */
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    /* Use card background */
    border: 1px solid var(--accent-color);
    /* Highlight border */
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    /* Ensure on top */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.search-result-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(3, 218, 198, 0.1);
}

.search-result-name {
    font-weight: bold;
    color: var(--primary-color);
}

.search-result-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}


/* Redundant Domain Section Removed and Consolidated Above */

/* Global Search Dropdown Refinement */
.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid var(--accent-color);
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    margin-top: 4px;
}

.search-results-dropdown.hidden {
    display: none;
}

.search-result-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: rgba(3, 218, 198, 0.1);
}

/* Force Global Search Width */
#global-spell-search {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
}


/* Force Global Search to full width */
.global-search-container {
    width: 100% !important;
    box-sizing: border-box;
    display: block;
    clear: both;
}


/* Info Icon in Modal Spell Selection */
.spell-selection-item .info-icon {
    color: var(--primary-color);
    font-size: 1.2rem;
    opacity: 0.7;
    transition: opacity 0.2s, color 0.2s;
    cursor: pointer;
    padding: 4px;
}

.spell-selection-item .info-icon:hover {
    opacity: 1;
    color: var(--accent-color);
}



/* Metamagic Icon Styling */
.known-mm-item .mm-icon {
    color: var(--accent-color);
    font-size: 0.95rem;
}

.mm-option .mm-icon {
    color: var(--accent-color);
    font-size: 0.9rem;
    margin-right: 4px;
}



/* Mobile Optimizations */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: 95%;
        height: 90vh;
        padding: 0;
    }

    .modal-header {
        padding: 12px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-sticky-section {
        padding: 10px;
    }

    .spell-search {
        padding: 10px;
        font-size: 0.95rem;
    }

    .modal-spell-list {
        padding: 10px;
    }

    .spell-selection-item {
        padding: 8px 10px;
        font-size: 0.85rem;
        min-height: 50px;
    }

    .spell-selection-item .spell-name {
        font-size: 0.82rem;
    }

    .spell-selection-item .info-icon {
        font-size: 1rem;
    }

    /* Detail Modal */
    .detail-modal-content {
        width: 95%;
        max-width: 95%;
    }

    .detail-header h2 {
        font-size: 1.1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 10px;
    }

    .stat-box {
        padding: 6px;
    }

    .detail-description-container {
        padding: 0 10px 10px;
    }

    .detail-description-container h3 {
        font-size: 1rem;
    }

    .detail-description-container p {
        font-size: 0.9rem;
    }

    /* Metamagic options in modal */
    .mm-option {
        padding: 6px 10px;
        font-size: 0.8rem;
    }

    /* Horizontal Alignment & Unified Spacing */
    .settings-grid,
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .level-header {
        padding: 10px;
    }

    .level-title {
        font-size: 1rem;
    }

    .slots-info {
        font-size: 0.85rem;
    }

    .slot-tracker {
        padding: 8px 10px 4px;
        gap: 6px;
        justify-content: center;
        /* Center slots for better horizontal balance on small screens */
    }

    .slot-icon {
        width: 12px;
        height: 12px;
    }

    .prepared-spells-list {
        padding: 8px 10px;
    }

    .prepared-spell-item {
        padding: 8px;
    }

    .operational-panel {
        padding: 12px;
        margin-bottom: 15px;
    }

    .app-container {
        padding: 0 5px;
    }
}

/* Toast Notification */
/* Removed duplicate - handled at line 872 */

@media (max-width: 768px) {
    .toast {
        bottom: 20px;
        padding: 10px 20px;
        font-size: 0.85rem;
        max-width: 90%;
    }
}

/* Spell Icons Container */
.spell-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spell-selection-item .remove-icon {
    color: #e57373;
    font-size: 1.1rem;
    opacity: 0.8;
    transition: opacity 0.2s, color 0.2s;
    cursor: pointer;
    padding: 4px;
}

.spell-selection-item .remove-icon:hover {
    opacity: 1;
    color: #ef5350;
}

.spell-count {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 4px;
}

/* Spell Icons Container */
.spell-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spell-selection-item .remove-icon {
    color: #e57373;
    font-size: 1.1rem;
    opacity: 0.8;
    transition: opacity 0.2s, color 0.2s;
    cursor: pointer;
    padding: 4px;
}

.spell-selection-item .remove-icon:hover {
    opacity: 1;
    color: #ef5350;
}

.spell-count {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 4px;
}

/* Spell Icons Container */
.spell-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.spell-selection-item .remove-icon {
    color: #e57373;
    font-size: 1.1rem;
    opacity: 0.8;
    transition: opacity 0.2s, color 0.2s;
    cursor: pointer;
    padding: 4px;
}

.spell-selection-item .remove-icon:hover {
    opacity: 1;
    color: #ef5350;
}

.spell-count {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 0.85rem;
    margin-left: 4px;
}

/* Metamagic Modal Grid */
.metamagic-modal-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 15px;
}

.metamagic-modal-item {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--input-bg);
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.metamagic-modal-item:hover {
    border-color: var(--accent-color);
    background: rgba(3, 218, 198, 0.05);
}

.metamagic-modal-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-color);
}

.metamagic-modal-item .mm-icon {
    color: var(--accent-color);
    font-size: 1rem;
}

.metamagic-modal-item .mm-name {
    flex: 1;
    font-size: 0.9rem;
    color: var(--text-main);
}

.metamagic-modal-item .info-icon {
    color: var(--primary-color);
    font-size: 1.1rem;
    opacity: 0.7;
    transition: opacity 0.2s;
    cursor: pointer;
    padding: 4px;
}

.metamagic-modal-item .info-icon:hover {
    opacity: 1;
    color: var(--accent-color);
}

/* Primary Button Style */
.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--accent-color);
    border: none;
    color: #121212;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.btn-primary:hover {
    background: #4dd0e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(3, 218, 198, 0.3);
}

@media (max-width: 768px) {
    .metamagic-modal-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }

    .metamagic-modal-item {
        padding: 10px;
    }
}

/* ==========================================================================
   Prepared Spells Chips (Scrollable UX)
   ========================================================================== */
.modal-prepared-container {
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--border-color);
}

.modal-slots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modal-slots-count {
    font-weight: bold;
    color: var(--accent-color);
}

/* Horizontal scrollable container without scrollbars */
.modal-prepared-chips {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    /* Smooth scroll for mobile */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
}

/* Hide scrollbar for Chrome/Safari */
.modal-prepared-chips::-webkit-scrollbar {
    display: none;
}

/* Individual spell chip styling */
.spell-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(3, 218, 198, 0.15);
    /* Accent tint */
    border: 1px solid rgba(3, 218, 198, 0.3);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
    /* Prevent wrapping */
    transition: background 0.2s, transform 0.1s;
}

.spell-chip.is-domain {
    background: rgba(255, 255, 255, 0.1);
    border: 1px dashed rgba(255, 255, 255, 0.3);
}

.spell-chip-name {
    font-weight: bold;
}

.spell-chip-meta {
    font-size: 0.75rem;
    color: #ffd54f;
    /* Highlight for metamagic tags */
    font-style: italic;
    opacity: 0.9;
}

.spell-chip-remove {
    cursor: pointer;
    color: #e57373;
    /* Red indicator */
    margin-left: 2px;
    padding: 2px 4px;
    /* Give it a better tap target */
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spell-chip-remove:hover {
    color: #ef5350;
    transform: scale(1.1);
}

/* When empty */
.modal-prepared-chips:empty::after {
    content: 'Nessun incantesimo preparato.';
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    font-style: italic;
    padding: 4px 0;
}

/* ==========================================================================
   Spell Detail Description Refinements (Tables & Links)
   ========================================================================== */

/* Tables inside description */
#detail-description table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#detail-description th,
#detail-description td {
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 12px;
    text-align: left;
}

#detail-description tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

#detail-description tr.golarion-first-row {
    background: rgba(3, 218, 198, 0.1) !important;
    font-weight: bold;
    color: var(--accent-color);
}

/* Hyperlinks in description */
#detail-description a {
    color: #4db6ac;
    /* A soft teal/cyan that contrast well with dark bg */
    text-decoration: none;
    border-bottom: 1px dashed rgba(77, 182, 172, 0.4);
    transition: all 0.2s ease;
}

#detail-description a:hover {
    color: var(--accent-color);
    border-bottom: 1px solid var(--accent-color);
    background: rgba(3, 218, 198, 0.05);
}

/* Fix for bold stats often found in bad extractions */
#detail-description b {
    color: var(--accent-color);
    font-weight: 600;
}

/* ==========================================================================
   Bottom Navigation & View Switching
   ========================================================================== */

.app-view {
    display: none;
    animation: fadeIn 0.3s ease;
    min-height: calc(100vh - 150px);
    /* Previene il salto della nav su viste corte */
}

.app-view.active {
    display: block;
}

.placeholder-view {
    text-align: center;
    padding: 3rem 1rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    border: 1px dashed var(--border-color);
    color: var(--text-muted);
}

/* Reduced Height Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 52px;
    /* Altezza ridotta per mobile */
    background: rgba(18, 18, 18, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 4000;
    /* Stay above everything to allow switching */
    padding-bottom: env(safe-area-inset-bottom, 0px);
}


.bottom-nav::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: -1;
    background: var(--bg-app);
}

.nav-item {
    flex: 1;
    /* Divide lo spazio in modo identico per tutti i tasti */
    padding: 6px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    gap: 3px;
    user-select: none;
    position: relative;
    z-index: 1;
}

.nav-item.active {
    color: var(--accent-color);
}

.nav-item:active {
    scale: 0.94;
    /* Feedback tattico alla pressione */
}


.nav-item i {
    font-size: 1.25rem;
    /* Leggermente più grande per visibilità */
    transition: transform 0.2s ease;
}

.nav-item.active i {
    transform: translateY(-2px);
}

.nav-item span {
    font-size: 0.7rem;
    font-weight: 600;
}


/* Sheet View Styles */
.sheet-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.sheet-section {
    background: var(--card-bg);
    padding: 18px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.section-title {
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-size: 1.1rem;
    margin: 0 0 15px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    align-items: flex-end;
    /* Align inputs even if labels wrap */
}

.setting-group label {
    line-height: 1.2;
    min-height: 2.4em;
    /* Reserve space for 2 lines to keep inputs aligned */
    display: flex;
    align-items: flex-end;
}

.inventory-content {
    padding-bottom: 20px;
    /* Safe space to prevent nav interference */
}

.trait-box {
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    transition: background 0.2s;
}

.trait-box:hover {
    background: rgba(255, 255, 255, 0.06);
}

.checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer !important;
}

.checkbox-container input {
    cursor: pointer !important;
    width: 20px;
    height: 20px;
}

.trait-info {
    display: flex;
    flex-direction: column;
    pointer-events: none;
    /* Let the label handle click */
}

.trait-name {
    font-weight: bold;
    color: var(--accent-color);
    font-size: 1rem;
}

.trait-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ==========================================================================
   Inventory Styles
   ========================================================================== */
.inventory-section {
    margin-bottom: 20px;
}

.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.section-header-row .section-title {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.btn-add-item {
    background: var(--accent-color);
    color: #000;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-add-item:hover {
    transform: scale(1.1);
    background: #4dd0e1;
}

/* Inventory Item Layout */
.inventory-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.inventory-item {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.inventory-item.to-sell {
    border-left: 4px solid #c35214;
    background: rgba(195, 82, 20, 0.05);
}

.item-main {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.item-name-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.item-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 1rem;
}

.sell-badge {
    font-size: 0.6rem;
    font-weight: 800;
    background: var(--accent-color);
    color: #121212;
    padding: 1px 5px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.item-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.item-val-display {
    font-weight: 800;
    color: var(--text-muted);
    background: #252525;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid #333;
    font-size: 0.75rem;
    line-height: 1;
    display: inline-block;
}

.item-sale-badge {
    background: rgba(195, 82, 20, 0.1);
    color: #ff8a65;
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid rgba(195, 82, 20, 0.2);
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1;
    display: inline-block;
}

.sell-star-block {
    width: 44px;
    height: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid #333;
    color: #444;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.sell-star-block.active {
    background: rgba(195, 82, 20, 0.15);
    border-color: #c35214;
    color: #c35214;
    box-shadow: inset 0 0 10px rgba(195, 82, 20, 0.1);
}

.sell-star-block i {
    font-size: 1.1rem;
}

.item-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #2a2a2a;
    padding-top: 8px;
}

.item-qty-control {
    display: flex;
    align-items: center;
    background: #252525;
    border-radius: 8px;
    padding: 2px;
    border: 1px solid #333;
}

.qty-btn {
    background: none;
    border: none;
    color: var(--text-main);
    width: 26px;
    height: 26px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    border-radius: 4px;
}

.qty-btn:hover {
    background: rgba(255, 255, 255, 0.05);
}

.qty-display {
    min-width: 25px;
    text-align: center;
    font-weight: 800;
    font-size: 0.9rem;
}

.item-tools {
    display: flex;
    gap: 15px;
    align-items: center;
}

.action-icon {
    font-size: 1.1rem;
    cursor: pointer;
    color: #666;
    transition: all 0.2s ease;
}

.action-icon:hover {
    color: var(--text-main);
    transform: scale(1.1);
}

.sell-btn.active {
    color: var(--accent-color);
}

.transfer-btn:hover {
    color: var(--primary-color);
}

.remove-item-btn:hover {
    color: #ff5252;
}

@media (max-width: 480px) {
    .inventory-item {
        padding: 10px;
    }

    .item-name {
        font-size: 0.9rem;
    }

    .item-tools {
        gap: 12px;
    }
}

.coins-layout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 15px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 12px;
}

.coins-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.coin-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 2px;
    transition: all 0.2s;
    overflow: hidden;
}

.coin-control:hover {
    border-color: var(--accent-light);
}

.coin-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 60px;
}

.coin-info i {
    font-size: 1rem;
    margin-bottom: 2px;
}

.coin-info i.cp {
    color: #cd7f32;
}

.coin-info i.sp {
    color: #c0c0c0;
}

.coin-info i.gp {
    color: #ffd700;
}

.coin-info i.pp {
    color: #e5e4e2;
}

.coin-value {
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
}

.coin-info label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: bold;
}

.coin-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--text-main);
    width: 32px;
    height: 38px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.coin-btn.minus {
    color: #e57373;
    border-right: 1px solid var(--border-color);
}

.coin-btn.plus {
    color: var(--accent-color);
    border-left: 1px solid var(--border-color);
}

.coin-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.coin-btn:active {
    scale: 0.9;
}

.coins-total-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
    padding: 15px 10px;
    border-radius: 50%;
    width: 100px;
    height: 100px;
    border: 2px solid var(--accent-color);
    box-shadow: 0 0 15px rgba(3, 218, 198, 0.1);
    flex-shrink: 0;
}

.coins-total-display .total-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-align: center;
    line-height: 1.2;
}

.coins-total-display .total-amount {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-color);
    font-family: var(--font-heading);
}

.coins-total-display .total-unit {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
}

/* Modal Specific */
.coin-modal-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.coin-modal-display i {
    font-size: 3rem;
}

.coin-modal-display span {
    font-size: 1.2rem;
    font-weight: bold;
    text-transform: uppercase;
}

@media (max-width: 480px) {
    .coins-layout {
        gap: 4px;
        padding: 8px 4px;
        justify-content: center;
    }

    .coins-column {
        gap: 8px;
        flex: 1;
        min-width: 0;
    }

    .coins-total-display {
        width: 75px;
        height: 75px;
        padding: 5px;
        border-width: 1.5px;
    }

    .coins-total-display .total-amount {
        font-size: 1rem;
    }

    .coins-total-display .total-label {
        font-size: 0.45rem;
        transform: scale(0.9);
    }

    .coin-control {
        padding: 1px;
        border-radius: 6px;
    }

    .coin-info {
        min-width: 40px;
    }

    .coin-value {
        font-size: 0.9rem;
    }

    .coin-info label {
        font-size: 0.55rem;
    }

    .coin-btn {
        width: 26px;
        height: 34px;
        font-size: 1rem;
    }
}

@media (max-width: 380px) {
    .coins-total-display {
        width: 65px;
        height: 65px;
    }

    .coins-total-display .total-amount {
        font-size: 0.9rem;
    }

    .coin-info {
        min-width: 35px;
    }
}

.btn-metamagic-manager {
    width: 100%;
    padding: 12px;
    background: var(--accent-light);
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-transform: uppercase;
}

/* Redefine Spell Blocks specifically */
.spell-level-block {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.level-header {
    padding: 12px 15px;
    background: #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.slots-info {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    white-space: nowrap;
}

.slots-count {
    color: var(--accent-color);
}

.level-title {
    margin: 0;
    font-size: 1.1rem;
    font-family: var(--font-heading);
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Mobile Optimizations for Horizontal Overflow */
@media (max-width: 480px) {
    .main-header h1 {
        font-size: 1.5rem;
    }

    .level-header,
    .section-header-row {
        padding: 10px 12px;
    }

    .header-left,
    .section-title {
        gap: 10px;
        min-width: 0;
        flex: 1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .section-title {
        font-size: 1.1rem;
    }

    .header-right,
    .btn-add-item {
        gap: 8px;
        flex-shrink: 0;
    }

    .slots-info {
        font-size: 0.75rem;
    }

    .nav-item span {
        font-size: 0.68rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        padding: 0 2px;
        width: 100%;
        text-align: center;
    }
}

@media (max-width: 360px) {
    .nav-item span {
        font-size: 0.62rem;
        letter-spacing: -0.3px;
    }

    .header-left {
        gap: 6px;
    }

    .header-right {
        gap: 5px;
    }
}

.orison-usage-controls {
    display: flex;
    align-items: center;
    background: #141414;
    border-radius: 20px;
    padding: 2px;
    border: 1px solid #333;
    scale: 0.9;
    transform-origin: left center;
}

.orison-btn {
    background: var(--accent-color);
    border: none;
    color: #121212;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    line-height: 1;
}

.orison-count-display {
    padding: 0 10px;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-main);
    min-width: 45px;
    text-align: center;
}

/* ==========================================================================
   Slot Tracker Icons
   ========================================================================== */
.slot-tracker {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 15px 5px;
    background: rgba(0, 0, 0, 0.1);
}

.slot-icon {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    position: relative;
}

/* Slot pronto (con incantesimo) */
.slot-icon.full {
    background: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(129, 212, 250, 0.4);
}

/* Slot usato o vuoto */
.slot-icon.used,
.slot-icon.empty {
    background: #444;
    border-color: #555;
}

/* Toast Notifications */
/* Removed duplicate - handled at line 872 */

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #121212;
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* ==========================================================================
   Premium Item Modal Styles
   ========================================================================== */
.item-modal-premium {
    background: rgba(30, 30, 30, 0.95) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(129, 212, 250, 0.2) !important;
    max-width: 500px !important;
    height: auto !important;
    max-height: 95vh !important;
    display: flex;
    flex-direction: column;
}

.item-modal-premium .modal-body {
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.item-form-container {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.form-section {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section.centered {
    display: flex;
    justify-content: center;
    border-bottom: none;
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--accent-color);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: rgba(44, 44, 44, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    padding: 12px;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-color);
    background: rgba(44, 44, 44, 0.9);
    box-shadow: 0 0 10px rgba(129, 212, 250, 0.1);
    outline: none;
}

.form-row-responsive {
    display: flex;
    gap: 15px;
}

.value-currency-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.flex-3 {
    flex: 3;
}

/* Premium Toggle Switch */
.premium-toggle-label {
    width: 100%;
    cursor: pointer;
}

.premium-toggle-label input {
    display: none;
}

.toggle-track {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-thumb {
    width: 32px;
    height: 32px;
    background: #333;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.3s ease;
}

.toggle-text {
    font-weight: 800;
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.premium-toggle-label input:checked+.toggle-track {
    background: rgba(195, 82, 20, 0.08);
    border-color: #c35214;
    box-shadow: 0 0 15px rgba(195, 82, 20, 0.1);
}

.premium-toggle-label input:checked+.toggle-track .toggle-thumb {
    background: #c35214;
    color: white;
    box-shadow: 0 0 10px rgba(195, 82, 20, 0.3);
}

.premium-toggle-label input:checked+.toggle-track .toggle-text {
    color: #c35214;
}

/* Modal Footer Actions */
.modal-footer-actions {
    padding: 15px 20px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-premium-action {
    width: 100%;
    padding: 16px;
    background: var(--accent-color);
    color: #000;
    border: none;
    border-radius: 12px;
    font-weight: 900;
    font-size: 1rem;
    letter-spacing: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-premium-action:hover {
    transform: translateY(-3px);
    background: #4dd0e1;
    box-shadow: 0 8px 20px rgba(129, 212, 250, 0.3);
}

.btn-premium-action:active {
    transform: translateY(0);
}

/* Tablet & Mobile Adjustments */
@media (max-width: 480px) {
    .form-row-responsive {
        flex-direction: column;
        gap: 0;
    }

    .item-form-container {
        padding: 15px;
    }

    .item-modal-premium {
        width: 100% !important;
        margin: 0 10px;
    }

    .form-group {
        margin-bottom: 20px;
    }
}



/* Sell All Button in Sell List Modal */
.sell-all-footer {
    display: flex;
    flex-direction: column;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
}

.sell-all-value {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 12px;
    font-weight: bold;
    font-size: 1rem;
    color: #fbc02d;
    text-align: center;
    gap: 4px;
}

#sell-all-total-value {
    font-size: 1.3rem;
    color: #fff;
    text-shadow: 0 0 8px rgba(251, 192, 45, 0.6);
}

.btn-sell-all {
    background: linear-gradient(135deg, #c35214, #e65100);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    font-weight: bold;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.btn-sell-all:hover {
    background: linear-gradient(135deg, #e65100, #ff6d00);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(195, 82, 20, 0.5);
}

.btn-sell-all i {
    font-size: 1.1rem;
}

/* Coin Update Modal Styles */
.coin-update-modal-content {
    max-width: 320px !important;
    height: auto !important;
}

.coin-update-body {
    padding: 15px 20px 25px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.coin-modal-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.coin-modal-display i {
    font-size: 3.5rem;
    color: var(--accent-color);
    text-shadow: 0 0 15px rgba(129, 212, 250, 0.4);
}

.coin-modal-display span {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
    letter-spacing: 1px;
}

.coin-input-group {
    width: 100%;
    margin-bottom: 25px;
    text-align: center;
}

.coin-input-group label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.coin-input-group input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    color: #fff;
    font-size: 1.8rem;
    text-align: center;
    font-family: 'Cinzel', serif;
}

/* Responsive Header Fix */
@media (max-width: 480px) {
    .main-header {
        flex-wrap: nowrap;
        justify-content: space-between;
        align-items: center;
    }
}