:root {
    --bg-dark: #1e1e1e; /* Slightly lighter dark */
    --bg-card: #2d2d2d; /* Card background */
    --text-light: #f0f0f0;
    --text-medium: #a0a0a0;
    --primary-accent: #00d1b2; /* Teal/Green */
    --primary-accent-hover: #00b89a;
    --secondary-accent: #ffae42; /* Orange/Yellow */
    --secondary-accent-hover: #f39c12;
    --danger-color: #e74c3c;
    --danger-color-hover: #c0392b;
    --border-color: #444;
    --font-family: 'Roboto', sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    padding-top: 20px; /* Space for header */
    padding-bottom: 20px; /* Space for footer */
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding: 15px 0;
    background-color: var(--bg-card);
    box-shadow: var(--box-shadow);
}

header h1 {
    color: var(--primary-accent);
    font-weight: 700;
    font-size: 2.5em;
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.card {
    background-color: var(--bg-card);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border-top: 3px solid var(--primary-accent);
}

.card h2 {
    color: var(--text-light);
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 1.8em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.card h2 .icon {
    margin-right: 10px;
}

.drop-zones-container {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.drop-zone {
    flex: 1;
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background-color: rgba(0,0,0,0.1); /* Slightly darker than card bg */
    transition: border-color 0.3s ease, background-color 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px; /* Increased height */
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary-accent);
    background-color: rgba(0, 209, 178, 0.05); /* Subtle primary accent bg */
}

.drop-zone .preview-thumb {
    max-width: 80px;
    max-height: 60px;
    margin-bottom: 10px;
    border-radius: 4px;
    object-fit: cover;
    border: 1px solid var(--border-color);
}
.drop-zone .audio-icon {
    font-size: 2.5em;
    color: var(--primary-accent);
    margin-bottom: 10px;
}

.drop-zone-text {
    font-size: 0.95em;
    color: var(--text-medium);
    margin-bottom: 5px;
}

.file-name-display {
    font-size: 0.8em;
    color: var(--text-light);
    word-break: break-all;
    margin-top: 5px;
}

.duration-preview {
    font-size: 0.8em;
    color: var(--secondary-accent);
    font-weight: 500;
    margin-top: 8px;
}

.button {
    display: inline-flex; /* For icon alignment */
    align-items: center;
    justify-content: center;
    padding: 12px 25px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.1s ease;
    text-decoration: none;
    color: white; /* Default text color for buttons */
}
.button .icon {
    margin-right: 8px;
}

.button:active {
    transform: translateY(1px);
}

.button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.primary-button {
    background-color: var(--primary-accent);
    width: 100%; /* Make add pair button full width */
}
.primary-button:hover:not(:disabled) {
    background-color: var(--primary-accent-hover);
}

.secondary-button {
    background-color: #555; /* A neutral dark gray */
}
.secondary-button:hover:not(:disabled) {
    background-color: #666;
}

.accent-button {
    background-color: var(--secondary-accent);
    color: var(--bg-dark); /* Dark text on light accent for contrast */
}
.accent-button:hover:not(:disabled) {
    background-color: var(--secondary-accent-hover);
}

.download-button {
    background-color: var(--primary-accent);
}
.download-button:hover:not(:disabled) {
    background-color: var(--primary-accent-hover);
}

#timeline-list {
    list-style-type: none;
    padding: 0;
    min-height: 60px; /* Placeholder height */
}

.timeline-placeholder {
    text-align: center;
    color: var(--text-medium);
    padding: 20px;
    font-style: italic;
}

#timeline-list li:not(.timeline-placeholder) {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background-color 0.3s ease;
}

#timeline-list li.active-track {
    background-color: rgba(0, 209, 178, 0.15); /* Primary accent highlight */
    border-left: 4px solid var(--primary-accent);
}

#timeline-list li img.timeline-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

#timeline-list li .details {
    flex-grow: 1;
}

#timeline-list li .details span {
    display: block;
    font-size: 0.9em;
    color: var(--text-medium);
}
#timeline-list li .details span.file-name {
    color: var(--text-light);
    font-weight: 500;
    margin-bottom: 3px;
}
#timeline-list li .details span.duration {
    color: var(--secondary-accent);
    font-size: 0.85em;
}

.delete-track-button {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
    border-radius: 50%; /* Make it round */
    width: 30px;
    height: 30px;
    font-size: 1.2em; /* Adjust icon size */
    font-weight: bold;
    padding: 0; /* Reset padding for precise centering */
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1; /* For better vertical centering of text/icon */
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.delete-track-button:hover {
    background-color: var(--danger-color);
    color: white;
}

.canvas-wrapper {
    position: relative;
    width: 100%;
    max-width: 640px; /* Keep canvas aspect ratio */
    margin: 0 auto 20px auto; /* Center canvas wrapper */
    background-color: #000;
    border-radius: var(--border-radius);
    overflow: hidden; /* Ensures recording indicator is contained */
}

#main-canvas {
    display: block;
    width: 100%;
    height: auto; /* Maintain aspect ratio */
    background-color: #000; /* Black background for images that don't fill canvas */
}

#recording-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: rgba(231, 76, 60, 0.8); /* Red with alpha */
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.9em;
    font-weight: bold;
    z-index: 10;
}

#playback-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.total-duration, .timer-display {
    font-size: 0.9em;
    color: var(--text-medium);
    background-color: rgba(0,0,0,0.15);
    padding: 5px 10px;
    border-radius: 4px;
}
#total-duration-display {
    margin-left: 10px;
}

footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    color: var(--text-medium);
    font-size: 0.9em;
    border-top: 1px solid var(--border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    .card h2 {
        font-size: 1.5em;
    }
    .drop-zones-container {
        flex-direction: column;
    }
    .drop-zone {
        min-height: 150px;
    }
    #playback-controls {
        flex-wrap: wrap; /* Allow buttons to wrap */
    }
    .button {
        padding: 10px 20px;
        font-size: 0.95em;
    }
    #timeline-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    #timeline-list li img.timeline-thumb {
        width: 100%; /* Full width on small screens */
        max-width: 120px; /* But not too large */
        height: auto;
    }
    .delete-track-button {
        align-self: flex-end; /* Position delete button */
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.8em;
    }
    .card {
        padding: 15px;
    }
    .card h2 {
        font-size: 1.3em;
    }
    .button {
        width: 100%; /* Make all buttons full width on very small screens */
        margin-bottom: 10px; /* Add space between stacked buttons */
    }
    .button:last-child {
        margin-bottom: 0;
    }
    #playback-controls .button {
      flex-basis: 48%; /* Two buttons per row if possible */
      width: auto; /* Override full width if flex basis is set */
    }
    #playback-controls .timer-display {
      flex-basis: 100%;
      text-align: center;
      margin-top: 10px;
    }
    .drop-zone .audio-icon {
        font-size: 2em;
    }
    .drop-zone-text {
        font-size: 0.9em;
    }
}