:root {
    --bg-dark: #0c0e14;
    --sidebar-bg: rgba(15, 17, 26, 0.6);
    --panel-bg: rgba(30, 34, 46, 0.4);
    --border-color: rgba(255, 255, 255, 0.1);

    --accent-primary: #00d1ff;
    /* Cyan */
    --accent-secondary: #ff00d4;
    /* Pink */
    --accent-gradient: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));

    --text-main: #ffffff;
    --text-muted: #a0a0a0;

    --danger: #ff4757;
    --success: #2ed573;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 10% 20%, rgba(0, 209, 255, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(255, 0, 212, 0.1) 0%, transparent 20%);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    height: 100vh;
    overflow: hidden;
}

#app {
    display: flex;
    height: 100%;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Sidebar */
#sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.brand h1 {
    margin: 0 0 30px 0;
    font-size: 1.5rem;
    letter-spacing: 2px;
}

.accent {
    background: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 1px;
}

#jump-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.jump-item {
    padding: 12px 15px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.jump-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.jump-item.active {
    background: rgba(0, 209, 255, 0.1);
    border-color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 209, 255, 0.1);
}

.sidebar-footer {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* Main Content */
#main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    position: relative;
}

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.hidden {
    display: none !important;
}

/* Welcome Screen */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

/* Button Styling Refinement */
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(0, 209, 255, 0.2);
}

.btn-secondary.danger-zone:hover {
    background: rgba(255, 0, 90, 0.1);
    box-shadow: 0 0 10px rgba(255, 0, 90, 0.2);
}

/* Icon Buttons (Add/Remove) */
.icon-btn {
    background: rgba(0, 209, 255, 0.1);
    border: 1px solid rgba(0, 209, 255, 0.3);
    color: var(--accent-primary);
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}

.icon-btn:hover {
    background: var(--accent-primary);
    color: #000;
    box-shadow: 0 0 8px var(--accent-primary);
}

.icon-btn.danger {
    background: rgba(255, 0, 90, 0.1);
    border-color: rgba(255, 0, 90, 0.3);
    color: var(--danger);
}

.icon-btn.danger:hover {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 0 8px var(--danger);
}

.icon-btn.success {
    background: rgba(0, 255, 150, 0.1);
    border-color: rgba(0, 255, 150, 0.3);
    color: var(--success);
}

.icon-btn.success:hover {
    background: var(--success);
    color: #000;
    box-shadow: 0 0 8px var(--success);
}

.btn-remove {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.2s;
    padding: 0 5px;
}

.btn-remove:hover {
    color: var(--danger);
    opacity: 1;
    text-shadow: 0 0 5px var(--danger);
}

/* Input Polish */
.entry-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 4px;
}

.entry-details {
    flex: 1;
}

.entry-cost {
    width: 60px;
    text-align: right;
    font-size: 0.9rem;
    color: var(--accent-primary) !important;
    font-weight: bold;
}

/* Log Creator Polish */
.log-creator {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    margin-top: 10px;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.log-creator input,
.log-creator textarea {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 4px !important;
    padding: 8px !important;
}

.log-creator input:focus,
.log-creator textarea:focus {
    border-color: var(--accent-primary) !important;
    background: rgba(255, 255, 255, 0.05) !important;
}

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

.stat-card h3 {
    margin: 0 0 10px 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-card span {
    font-size: 2rem;
    font-weight: 600;
    color: var(--accent-primary);
}

/* Jump Details */
.jump-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.editable-title {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.8rem;
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    width: 100%;
    outline: none;
}

.editable-title:focus {
    border-bottom: 2px solid var(--accent-primary);
}

.budget-display {
    display: flex;
    gap: 30px;
    align-items: center;
}

.budget-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.budget-input {
    background: transparent !important;
    border: none !important;
    color: var(--text-main) !important;
    /* Match the white text of SPENT */
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    /* Match .value weight */
    width: 120px;
    text-align: right;
    /* Match alignment of other values */
    padding: 0;
    margin: 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.budget-input::-webkit-outer-spin-button,
.budget-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.budget-input:focus {
    outline: none;
    border-bottom: 1px solid var(--accent-primary) !important;
    background: rgba(0, 209, 255, 0.1) !important;
}

.budget-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.budget-item .value {
    font-size: 1.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
}

.budget-item .value.highlight {
    color: var(--accent-primary);
    text-shadow: 0 0 10px rgba(0, 209, 255, 0.5);
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
    height: calc(100% - 140px);
    /* Approximate height adjustment */
}

/* Content Grid Expanded */
.content-grid.expanded {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    height: auto;
    padding-bottom: 20px;
}

/* Column Styling */
.column {
    background: var(--panel-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Fill grid cell */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    transition: border-color 0.2s;
    overflow: hidden;
    /* Contain children */
}

.sidebar-section {
    margin-bottom: 20px;
}

.sidebar-header {
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.icon-btn.small-add {
    width: 20px;
    height: 20px;
    font-size: 1rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
}

.icon-btn.small-add:hover {
    background: var(--accent-primary);
    color: #000;
    border-color: var(--accent-primary);
}

.jump-item {
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    font-family: 'Outfit', sans-serif;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.panel-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--accent-secondary);
}

.scroll-list {
    flex: 1;
    overflow-y: auto;
}

/* Jump Meta (Origin) */
.input-origin {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    /* Darker background */
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    padding: 10px;
    outline: none;
    transition: all 0.2s;
}

.input-origin:focus {
    border-color: var(--accent-secondary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 10px rgba(255, 0, 212, 0.1);
}

.panel-subheader {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 10px 0 5px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-actions {
    display: flex;
    gap: 5px;
}

/* Tighter Entry Items */
.entry-item {
    background: rgba(0, 0, 0, 0.3);
    /* Darker for better contrast */
    border-radius: 6px;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.entry-header {
    margin-bottom: 4px;
}

.entry-name {
    font-size: 0.95rem;
}

.entry-cost {
    font-size: 0.75rem;
    padding: 1px 4px;
}

/* Integrated Inputs (No "Windows Forms" look) */
.entry-name,
.entry-cost,
.entry-description,
.input-origin,
.budget-input,
#jump-name {
    background: transparent !important;
    border: none !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 0 !important;
    color: var(--text-main) !important;
    padding: 5px 0 !important;
    transition: all 0.2s;
    box-shadow: none !important;
}

.entry-name:focus,
.entry-cost:focus,
.entry-description:focus,
.input-origin:focus,
.budget-input:focus,
#jump-name:focus {
    background: rgba(255, 255, 255, 0.05) !important;
    border-bottom-color: var(--accent-primary) !important;
}

/* Specific tweaks */
.entry-name {
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
}

.entry-cost {
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary) !important;
    width: 70px;
    /* Fixed width for alignment */
}


.entry-description {
    font-size: 0.85rem;
    color: var(--text-muted) !important;
    font-style: italic;
    resize: none;
    /* Auto-expand would be better, but fixed for now */
}

/* Sidebar Footer Buttons - Ensure Uniformity */
.sidebar-footer {
    margin-top: auto;
    /* Push to bottom */
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 20px;
}

.sidebar-footer button {
    width: 100%;
    height: 40px;
    /* Fixed height for uniformity */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.entry-description {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 6px;
    border-radius: 4px;
    width: 100%;
    resize: vertical;
    min-height: 30px;
    font-family: 'Outfit', sans-serif;
    transition: all 0.2s;
}

.entry-description:focus {
    background: rgba(0, 0, 0, 0.5);
    border-color: var(--accent-primary);
}

/* Scrollbar refinement */
.scroll-list::-webkit-scrollbar {
    width: 4px;
    /* Thinner */
}

.entry-item.item {
    border-left-color: #f1c40f;
}

/* Yellow */
.entry-item.companion {
    border-left-color: #9b59b6;
}

/* Purple */
.entry-item.scenario {
    border-left-color: #2ecc71;
}

/* Green */

.icon-btn.success:hover {
    background: var(--success);
    box-shadow: 0 0 10px var(--success);
}

/* Profile View */
.search-bar input {
    width: 100%;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1.2rem;
    margin-bottom: 20px;
}

.profile-stats {
    display: flex;
    gap: 15px;
}

.stat-pill {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.stat-pill span {
    color: var(--accent-primary);
    font-weight: bold;
}

.profile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding-bottom: 50px;
}

.profile-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

.profile-card h4 {
    margin: 0 0 5px 0;
    color: var(--accent-primary);
}

.profile-card .origin {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: block;
}

.profile-card p {
    font-size: 0.9rem;
    color: #ddd;
    line-height: 1.4;
}

/* Companion System */
.companion-roster-section {
    margin-bottom: 30px;
}

.grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.companion-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    position: relative;
    transition: all 0.2s;
}

.companion-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-secondary);
}

.character-switcher-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 20px;
    padding-left: 20px;
    border-left: 1px solid var(--border-color);
}

.character-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    padding: 8px 12px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.character-select:focus {
    border-color: var(--accent-primary);
}

.btn-secondary.small {
    padding: 5px 10px;
    font-size: 0.8rem;
}

/* Modal Styles */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s;
}

#modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    width: 400px;
    max-width: 90%;
    padding: 20px;
    transform: scale(1);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#modal-overlay.hidden .modal-content {
    transform: scale(0.9);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.modal-option {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-main);
    text-align: left;
    width: 100%;
    margin-bottom: 5px;
}

.modal-option:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-secondary);
}

/* Refactored Inline Styles */
.sidebar-footer {
    padding: 0 20px 10px 20px;
}

.btn-clear-data {
    margin-top: 10px;
    border-color: var(--danger);
    color: var(--danger);
}

.hidden-input {
    display: none;
}

.jump-meta-container {
    margin-top: 20px;
    padding: 15px;
}

.origin-desc-input {
    width: 100%;
    margin-top: 10px;
    min-height: 60px;
}

.log-input-title {
    width: 100%;
    margin-bottom: 5px;
}

.log-input-content {
    min-height: 100px;
    margin-bottom: 5px;
}

.log-actions {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
}

.btn-save-log {
    color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.profile-panel {
    padding: 30px;
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.profile-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.profile-filter-select {
    min-width: 150px;
}

.profile-search-bar {
    flex: 1;
}