* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    margin: 0;
}

.header {
    background: white;
    padding: 15px 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo {
    height: 40px;
    width: auto;
}

.logo-container h1 {
    margin: 0;
    font-size: 24px;
    color: #333;
}

.container {
    display: flex;
    height: calc(100vh - 70px);
    position: relative;
}

/* Chat Section */
.chat-section {
    flex: 0 0 30%;
    display: flex;
    flex-direction: column;
    padding: 15px;
    border-right: 1px solid #eee;
    background: white;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.chat-history {
    flex-grow: 1;
    padding: 15px 5px;
    overflow-y: auto;
    max-height: calc(100% - 200px);
    margin-bottom: 10px;
}

/* Chat Message Styles */
.chat-message {
    margin: 12px 0;
    padding: 12px 18px;
    border-radius: 15px;
    max-width: 85%;
    position: relative;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    line-height: 1.4;
    word-break: break-word;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
}

.chat-message.user {
    background: black;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.chat-message.ai {
    background: #f0f2f5;
    color: #333;
    margin-right: auto;
    border-bottom-left-radius: 5px;
}

.chat-message.ai.thought {
    background: #e6f7ff;
    color: #0066cc;
    border-left: 3px solid #0066cc;
    font-style: italic;
    padding-left: 15px;
    margin-bottom: 5px;
}

.chat-message.ai.thought::before {
    content: "Thought Process:";
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
    font-style: normal;
    color: #0066cc;
}

.chat-message.loading {
    opacity: 0.8;
}

.chat-message.loading span {
    display: inline-block;
    letter-spacing: 3px;
    font-weight: 500;
    color: #666;
}

.chat-message.error {
    background: #fff5f5;
    color: #dc3545;
    border: 2px solid #ffcdd2;
    padding-left: 15px;
}

.chat-message.error i {
    margin-right: 8px;
    color: #dc3545;
}

/* Typing Animation */
.typing-cursor {
    display: inline-block;
    width: 2px;
    height: 15px;
    background: #333;
    margin-left: 2px;
    animation: blink 1s infinite;
}

.chat-message.ai .typing-cursor {
    vertical-align: middle;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@keyframes loadingDots {
    0%, 100% { opacity: 0.2; }
    20% { opacity: 1; }
    40% { opacity: 0.2; }
}

@keyframes generating {
    0% { 
        opacity: 0.5;
        transform: scale(0.95);
        box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    }
    50% {
        opacity: 1;
        transform: scale(1.02);
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
    }
}

@keyframes changing {
    0% { 
        opacity: 1;
    }
    50% {
        opacity: 0.5;
        transform: scale(0.98);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes deleting {
    0% { 
        opacity: 1;
        transform: scale(1);
    }
    100% { 
        opacity: 0;
        transform: scale(0.8);
    }
}

@keyframes waveform {
    0% { height: 20%; }
    20% { height: 60%; }
    40% { height: 40%; }
    60% { height: 80%; }
    80% { height: 30%; }
    100% { height: 20%; }
}

/* Timestamp */
.chat-message::after {
    content: attr(data-time);
    position: absolute;
    bottom: -18px;
    font-size: 11px;
    color: #666;
}

.chat-message.user::after {
    right: 5px;
}

.chat-message.ai::after {
    left: 5px;
}

.generated-box-area {
    min-height: 100px;
    padding: 10px 0;
}

.generated-box {
    background: white;
    padding: 12px 15px;
    margin: 5px 0;
    cursor: move;
    border: 2px solid #eee;
    border-radius: 8px;
    user-select: none;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #333;
    display: flex;
    align-items: center;
    gap: 8px;
}

.generated-box::before {
    content: '🎵';
    font-size: 16px;
}

.generated-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #333;
}

.record-section {
    display: flex;
    justify-content: center;
}

.record-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: white;
    border: 2px solid #ff4444;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #ff4444;
}

.record-btn:hover {
    background: #fff5f5;
}

.record-icon {
    width: 12px;
    height: 12px;
    background: #ff4444;
    border-radius: 50%;
}

.chat-input {
    display: flex;
    gap: 10px;
    padding: 15px 0;
    margin-top: auto;
    align-items: flex-end;
}

.chat-input textarea {
    flex-grow: 1;
    padding: 12px 15px;
    border: 2px solid #eee;
    border-radius: 8px;
    outline: none;
    font-size: 14px;
    transition: all 0.3s ease;
    font-family: inherit;
    resize: none;
    max-height: 300px;
    line-height: normal;
    box-sizing: border-box;
    height: auto;
    overflow-y: hidden;
}

.chat-input textarea:focus {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.send-btn {
    padding: 12px 20px;
    background: black;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.send-btn::after {
    content: '→';
    font-size: 18px;
}

.send-btn:hover {
    background: #333;
}

/* Editor Section */
.editor-section {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #f8f9fa;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Transport Controls */
.transport-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.transport-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f0f2f5;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transport-btn:hover {
    background: #e4e6e9;
}

.transport-btn.active {
    background: black;
    color: white;
}

.transport-btn.loading {
    background: #f0f2f5;
    color: #666;
    cursor: wait;
    animation: spin 1s infinite linear;
}

.transport-btn.error {
    background: #fff5f5;
    color: #dc3545;
    animation: shake 0.5s ease-in-out;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.tempo-control {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 10px;
    height: 36px;
    background: #f0f2f5;
    border-radius: 18px;
    font-size: 14px;
}

/* Tools Section */
.tools-section {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 15px;
    border-left: 1px solid #eee;
    border-right: 1px solid #eee;
}

.tool-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-btn:hover {
    background: #f0f2f5;
    color: #333;
}

.tool-btn.active {
    background: black;
    color: white;
}

.zoom-controls {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

/* Global Controls */
.global-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.master-volume {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 15px;
}

.master-volume i {
    color: #666;
}

/* Volume Controls */
.volume-control.vertical {
    width: 21px;
    padding: 4px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    border-right: 1px solid #eee;
    position: relative;
}

.volume-control.vertical input[type="range"] {
    position: absolute;
    width: 80px;
    height: 16px;
    margin: 0;
    transform: rotate(-90deg) translateX(-40px) translateY(32px);
    transform-origin: left;
    cursor: pointer;
    -webkit-appearance: none;
    background: transparent;
}

.volume-control.vertical input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 0;
    height: 0;
    background: transparent;
}

.volume-control.vertical input[type="range"]::-webkit-slider-thumb:hover {
    transform: none;
    background: transparent;
}

.volume-control.vertical input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #eee;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

/* Track-specific volume colors */
.track[data-track="1"] .volume-control input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #ff6b4a var(--volume), #eee var(--volume));
}

.track[data-track="2"] .volume-control input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #7c5dfa var(--volume), #eee var(--volume));
}

.track[data-track="3"] .volume-control input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #ff4a7c var(--volume), #eee var(--volume));
}

.track[data-track="4"] .volume-control input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #4acfff var(--volume), #eee var(--volume));
}

.track[data-track="5"] .volume-control input[type="range"]::-webkit-slider-runnable-track {
    background: linear-gradient(to right, #4aff7c var(--volume), #eee var(--volume));
}

/* Track Layout */
.track {
    display: flex;
    flex-direction: row;
    border-bottom: 1px solid #eee;
    height: 120px;
    overflow: hidden;
}

.track-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.track:last-child {
    border-bottom: none;
}

/* Track Header */
.track-header {
    display: flex;
    flex-direction: column;
    background: #fafafa;
    border-bottom: 1px solid #eee;
    padding: 4px;
}

.track-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 28px;
}

.track-buttons {
    display: flex;
    gap: 5px;
    margin-left: auto;
}

.track-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.track-btn:hover {
    background: #eee;
    color: #333;
}

.track-btn.active {
    background: black;
    color: white;
}

.track-name {
    border: none;
    background: transparent;
    font-size: 14px;
    color: #666;
    width: 100px;
    padding: 2px 4px;
    border-radius: 4px;
}

.track-name:focus {
    background: white;
    outline: none;
    border: 1px solid #333;
}

.track-color-indicator {
    width: 4px;
    height: 16px;
    margin-right: 12px;
    border-radius: 2px;
}

.track[data-track="1"] .track-color-indicator { background: #ff6b4a; }
.track[data-track="2"] .track-color-indicator { background: #7c5dfa; }
.track[data-track="3"] .track-color-indicator { background: #ff4a7c; }
.track[data-track="4"] .track-color-indicator { background: #4acfff; }
.track[data-track="5"] .track-color-indicator { background: #4aff7c; }

.track-content {
    position: relative;
    flex-grow: 1;
    background: white;
    overflow: auto;
    background-image: repeating-linear-gradient(90deg, 
        transparent,
        transparent 59px,
        #f5f5f5 59px,
        #f5f5f5 60px
    );
}

.music-block {
    position: absolute;
    background: white;
    border: 2px solid;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #666;
    border-radius: 6px;
    cursor: move;
    user-select: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    flex-direction: column;
    padding: 5px;
}

.music-block:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.music-block.generating {
    animation: generating 1.5s ease;
}

.music-block.changing {
    animation: changing 0.8s ease;
}

.music-block.deleting {
    animation: deleting 0.8s ease forwards;
}

.music-block.overlay {
    z-index: 5;
    background: rgba(255, 255, 255, 0.9);
}

/* Waveform visualization */
.waveform {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    width: 80%;
    height: 20px;
    margin-top: 5px;
}

.waveform-bar {
    width: 4px;
    height: 40%;
    background: #666;
    border-radius: 1px;
    animation: waveform 1.2s infinite;
}

.waveform-bar:nth-child(1) { animation-delay: 0s; }
.waveform-bar:nth-child(2) { animation-delay: 0.2s; }
.waveform-bar:nth-child(3) { animation-delay: 0.4s; }
.waveform-bar:nth-child(4) { animation-delay: 0.6s; }
.waveform-bar:nth-child(5) { animation-delay: 0.8s; }

.waveform.edited .waveform-bar {
    background: #4CAF50;
}

.resize-handle-left,
.resize-handle-right {
    position: absolute;
    width: 6px;
    height: 100%;
    top: 0;
    background: rgba(0, 0, 0, 0.1);
    cursor: ew-resize;
}

.resize-handle-left {
    left: 0;
    border-top-left-radius: 6px;
    border-bottom-left-radius: 6px;
}

.resize-handle-right {
    right: 0;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.music-block.resizing {
    opacity: 0.8;
}

/* Timeline */
.timeline {
    height: 30px;
    position: relative;
    margin: 0;
    border: 1px solid #eee;
    border-radius: 4px;
    background: white;
}

.time-markers {
    height: 100%;
    position: relative;
}

.time-marker {
    position: absolute;
    height: 100%;
    border-left: 1px solid #eee;
}

/* Dragging styles */
.dragging {
    opacity: 0.5;
}

.track-content.drag-over {
    background: rgba(0, 0, 0, 0.05);
}
