/* --- General Setup & Typography --- */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --border-color: #dee2e6;
    --text-color: #212225;
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

html, body {
    height: 100%;
    min-height: 100vh;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

h1,
h2,
h3 {
    line-height: 1.2;
    margin-top: 20px;
    margin-bottom: 10px;
}

img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 15px;
}

/* --- Main Layout & View Toggling --- */
.main-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    max-width: 100vw;
}

/* Restrict width for editor and live views */
.main-container--centered {    
    max-width: 800px;
    margin: 70px auto 0 auto;
    width: 100%;
}

.view-toggle {
    position: fixed;
    width: 100%;
    top:0;
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    background-color: var(--surface-color);
    padding: 5px;
    box-shadow: var(--shadow);
    border-bottom: 1px solid var(--border-color);
}

.view-toggle button {
    padding: 10px 15px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    border-radius: 6px;
    transition: background-color 0.3s, color 0.3s;
}

.view-toggle button.active {
    background-color: var(--primary-color);
    color: white;
}

/* --- Live View Styles --- */
#live-view-container .live-section {
    background: var(--surface-color);
    padding: 20px 25px;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.live-section-buttons {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.live-section-buttons button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 5px;
    font-size: 15px;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.live-section-buttons button:hover {
    background-color: #0056b3;
}

/* --- Editor View Styles --- */
.global-controls {
    padding: 20px;
    margin-bottom: 20px;
    background: var(--surface-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.global-controls button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.global-controls button:hover {
    background-color: #218838;
}

.editor-section {
    background: var(--surface-color);
    margin-bottom: 25px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    transition: background-color 0.3s;
}

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

.editor-header-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-grow: 1;
}

.editor-header-title label {
    font-weight: bold;
}

.editor-header-title input {
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-weight: bold;
    flex-grow: 1;
}

.editor-header-controls button {
    background: var(--secondary-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.editor-header-controls .delete-section-btn {
    background: #dc3545;
}

.editor-content {
    padding: 15px;
}

.editor-section.collapsed .editor-content {
    display: none;
}

/* WYSIWYG Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    margin-bottom: 15px;
}

.toolbar button,
.toolbar select,
.toolbar input {
    font-family: inherit;
    padding: 6px 8px;
    border: 1px solid #ccc;
    background: #fff;
    cursor: pointer;
}

.toolbar .tool-label {
    align-self: center;
    font-size: 14px;
    margin: 0 5px;
}

[contenteditable="true"] {
    border: 1px solid var(--border-color);
    padding: 15px;
    min-height: 150px;
    border-radius: 6px;
    outline: none;
}

[contenteditable="true"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, .25);
}

/* Button Manager in Editor */
.button-manager {
    margin-top: 20px;
}

.button-manager h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 15px;
}

.button-entry {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.button-entry input,
.button-entry select {
    flex: 1 1 0;
    min-width: 0;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.button-entry .delete-button-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2em;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-button-btn {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
}

/* --- Node View Styles --- */
.node-grid {
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding: 40px 0;
}

.node-row {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    margin-bottom: 60px;
    gap: 60px;
    position: relative;
}

.node-box {
    background: var(--surface-color);
    border: 2px solid var(--primary-color);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 18px 32px;
    min-width: 120px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
    position: relative;
    transition: box-shadow 0.2s;
}

.node-box:hover {
    box-shadow: 0 8px 24px rgba(0, 123, 255, 0.15);
}

.node-title {
    margin-bottom: 0;
}

.node-arrow {
    display: none;
}

/* Make node view full width */
#node-view {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    margin-top: 49px;
}
#node-view-container {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
    height: 100%;
    width: 100%;
    min-width: 0;
}
#sigma-graph-container {
    width: 100% !important;
    height: calc(100vh - 70px - 60px); /* 70px for view-toggle, 60px for possible margins */
    min-width: 0;
    min-height: 0;
    box-sizing: border-box;
    flex: 1 1 auto;
}

/* --- Music URL Input Styles --- */
.music-url-input {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface-color);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.music-url-input label {
    font-weight: bold;
    margin-right: 8px;
    white-space: nowrap;
}
.music-url-input input[type="text"] {
    flex: 1 1 auto;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-size: 16px;
    background: #fff;
    box-sizing: border-box;
}

.sound-effects-manager {
    background: var(--surface-color);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}
.sound-effects-manager h4 {
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 15px;
}
.sound-effects-list {
    margin-bottom: 10px;
}

.sound-effect-entry {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}
.sound-effect-entry input[type="text"] {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
    font-size: 15px;
}
.delete-sound-effect-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 18px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.2em;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.add-sound-effect-btn {
    background-color: #17a2b8;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
} 