:root {
    --bg-color: #1e1e1e;
    --bg-secondary: #252526;
    --text-color: #cccccc;
    --accent-color: #D32F2F;
    --accent-hover: #B71C1C;
    --border-color: #3e3e42;
    --dropzone-bg: #2d2d30;
    --dropzone-border: #555;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #333; /* Background of the "host" app */
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Align widget to bottom */
    overflow: hidden;
}

.widget-container {
    height: 30vh; /* Approx 1/4 to 1/3 of screen */
    background-color: var(--bg-color);
    color: var(--text-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.3);
}

/* Tabs Header */
.tabs-header {
    display: flex;
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.tab-item {
    padding: 10px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    border-right: 1px solid var(--border-color);
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-item:hover {
    background-color: #3e3e42;
}

.tab-item.active {
    background-color: var(--bg-color);
    border-top: 2px solid var(--accent-color);
    color: #fff;
}

/* Tabs Content */
.tabs-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    position: relative;
}

.tab-pane {
    display: none;
    height: 100%;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Dropzone */
.dropzone {
    border: 2px dashed var(--dropzone-border);
    background-color: var(--dropzone-bg);
    border-radius: 8px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.3s, background-color 0.3s;
}

.dropzone.dragover {
    border-color: var(--accent-color);
    background-color: #3a3a3d;
}

.dropzone-content {
    text-align: center;
    color: #aaa;
}

.dropzone-content i {
    margin-bottom: 10px;
    color: #666;
}

.dropzone-content p {
    margin: 10px 0 15px;
    font-size: 1rem;
}

/* Buttons */
.btn-submit {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}

.btn-submit:hover {
    background-color: var(--accent-hover);
}

/* YT Import */
.yt-import-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.input-group {
    display: flex;
    width: 80%;
    max-width: 600px;
    gap: 10px;
}

.input-group input {
    flex: 1;
    padding: 10px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
    color: white;
}

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

/* Footer */
.widget-footer {
    height: 40px;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between; /* Space between logo and selector */
    padding: 0 15px;
    font-size: 0.8rem;
    position: relative;
}

.footer-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    color: #666;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.7rem;
}

.workspace-selector {
    margin-left: auto; /* Push to right */
}

.workspace-selector select {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Enhance Tab Specifics */
.file-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
}

.file-details {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #fff;
}

.btn-text {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    font-size: 1rem;
}

.btn-text:hover {
    color: #fff;
}

.section-title {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: #aaa;
    font-weight: normal;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.btn-preset {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 15px 10px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-preset i {
    font-size: 1.5rem;
    color: #666;
}

.btn-preset:hover {
    background-color: #3e3e42;
    border-color: #666;
}

.btn-preset.selected {
    background-color: rgba(211, 47, 47, 0.1); /* Red tint */
    border-color: var(--accent-color);
    color: #fff;
}

.btn-preset.selected i {
    color: var(--accent-color);
}

/* Controls Section */
.controls-wrapper {
    background-color: var(--bg-secondary);
    padding: 10px 15px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
    animation: slideDown 0.3s ease;
}

.controls-wrapper.compact-row {
    display: flex;
    align-items: center;
    gap: 20px;
}

.control-group {
    flex: 1;
}

.slider-group-fancy {
    flex: 1.5; /* More space for slider */
    min-width: 200px;
}

.player-group {
    flex: 2; /* More space for player */
}

.action-group {
    flex: 0 0 auto;
}

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

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.8rem;
    color: #aaa;
    font-weight: 500;
}

/* Fancy Slider */
.slider-container {
    position: relative;
    height: 6px;
    display: flex;
    align-items: center;
}

.slider.fancy-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #333;
    border-radius: 3px;
    outline: none;
    margin: 0;
    z-index: 2;
    position: relative;
    background: transparent; /* Let track fill show */
}

/* Track Background */
.slider.fancy-slider::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    background: #444;
    border-radius: 3px;
    border: none;
}

/* Thumb */
.slider.fancy-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--accent-color);
    cursor: pointer;
    margin-top: -6px; /* Center thumb */
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
    transition: transform 0.1s, box-shadow 0.1s;
}

.slider.fancy-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 8px rgba(211, 47, 47, 0.4);
}

/* Dynamic Fill (handled via JS usually, but we can use a gradient trick for simple cases or just rely on the thumb for now. 
   For a true "fill" to the left of the thumb in pure CSS with a single input, we can use a linear-gradient on the track if we update background-size via JS.
   Let's add the JS update for the background gradient to make it look "filled".
*/
.slider.fancy-slider {
    background-image: linear-gradient(var(--accent-color), var(--accent-color));
    background-size: 50% 100%;
    background-repeat: no-repeat;
    background-color: #444; /* Empty part color */
}

.slider.fancy-slider::-webkit-slider-runnable-track {
    background: transparent; /* Hide default track so gradient shows */
}

/* Modern Audio Player Mock */
.audio-player-modern {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #1e1e1e;
    padding: 8px 12px;
    border-radius: 30px; /* Pill shape */
    border: 1px solid var(--border-color);
    height: 40px;
    box-sizing: border-box;
}

.audio-player-modern.compact {
    width: 100%;
}

.btn-play-pause {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--accent-color);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.btn-play-pause:hover {
    background-color: var(--accent-hover);
}

.waveform-visual {
    flex: 1;
    height: 16px;
    display: flex;
    align-items: center;
    gap: 2px;
    overflow: hidden;
}

.bar {
    width: 3px;
    background-color: #444;
    border-radius: 1px;
    animation: wave 1s infinite ease-in-out;
    animation-play-state: paused;
}

/* Randomize heights for mock waveform */
.bar:nth-child(odd) { height: 60%; }
.bar:nth-child(even) { height: 40%; }
.bar:nth-child(3n) { height: 80%; }
.bar:nth-child(4n) { height: 30%; }

.audio-player-modern.playing .bar {
    animation-play-state: running;
    background-color: var(--accent-color);
}

@keyframes wave {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(0.5); }
}

.time-display {
    font-size: 0.7rem;
    color: #888;
    font-family: monospace;
    white-space: nowrap;
}

.full-width {
    width: 100%;
    padding: 10px;
    font-weight: bold;
}

/* Controls Header */
.controls-header-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: #fff;
    font-weight: bold;
}

.btn-icon-small {
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 1rem;
    padding: 5px;
    border-radius: 50%;
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-small:hover {
    background-color: #3e3e42;
    color: #fff;
}

/* Planning Tab */
.planning-layout {
    display: flex;
    height: 100%;
    gap: 20px;
}

.planning-left {
    flex: 0 0 250px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    border-right: 1px solid var(--border-color);
    padding-right: 20px;
}

.input-wrapper {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-wrapper label {
    font-size: 0.8rem;
    color: #aaa;
}

.input-wrapper select, .input-wrapper input {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 8px;
    border-radius: 4px;
    font-family: inherit;
}

.input-wrapper select:focus, .input-wrapper input:focus {
    outline: none;
    border-color: var(--accent-color);
}

.planning-right {
    flex: 1;
    overflow-x: auto;
    padding-bottom: 10px; /* Scrollbar space */
}

.planning-scroll-container {
    display: flex;
    gap: 20px;
    height: 100%;
}

.hour-group {
    display: flex;
    flex-direction: row; /* Horizontal layout: Label | Slots */
    min-width: 240px; /* Wider slots */
    background-color: rgba(255,255,255,0.03);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    overflow: hidden; /* For border radius */
    flex: 1; /* Take available width */
}

.hour-label {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 0.85rem;
    font-weight: bold;
    color: #fff;
    text-align: center;
    border-bottom: none;
    border-left: 1px solid var(--border-color);
    padding: 0 8px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0,0,0,0.2);
    width: 24px;
}

.slot-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    padding: 6px;
    overflow-y: auto;
}

.slot-item {
    background-color: var(--dropzone-bg);
    border: 1px dashed var(--dropzone-border); /* Thinner border */
    border-radius: 3px;
    padding: 0 10px;
    display: flex;
    flex-direction: row; /* Horizontal alignment */
    align-items: center;
    justify-content: flex-start;
    color: #666;
    transition: all 0.2s;
    cursor: pointer;
    min-height: 32px; /* Very compact */
}

.slot-item:hover {
    border-color: var(--accent-color);
    background-color: #3a3a3d;
    color: #ccc;
}

.slot-time {
    font-size: 0.75rem;
    font-weight: bold;
    color: var(--accent-color);
    margin: 0;
}

.slot-placeholder {
    display: none; /* Hide placeholder text */
}

/* Filled Slot State */
.slot-item.filled {
    border-style: solid;
    border-color: var(--border-color);
    background-color: var(--bg-secondary);
    justify-content: space-between;
    padding: 0 8px;
    gap: 8px;
    min-height: 32px;
}

.slot-content-filled {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    height: 100%;
}

.slot-info {
    display: flex;
    align-items: center; /* Horizontal alignment */
    gap: 10px;
    overflow: hidden;
}

.slot-time-small {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
    white-space: nowrap;
}

.audio-title {
    font-size: 0.8rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-mini-play {
    background-color: var(--accent-color);
    color: white;
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.6rem;
    flex-shrink: 0;
}

.btn-mini-play:hover {
    background-color: var(--accent-hover);
}

