@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --primary: #833ab4;
    --primary-gradient: linear-gradient(45deg, #833ab4, #fd1d1d, #fcb045);
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --accent: #38bdf8;
    --success: #22c55e;
    --warning: #eab308;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 10% 20%, rgba(131, 58, 180, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(253, 29, 29, 0.05) 0%, transparent 40%);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

@media (max-width: 600px) {
    .container {
        padding: 0.8rem;
    }
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.main-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2rem;
}

@media (max-width: 1000px) {
    .main-grid {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
}

/* Sidebar */
.config-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem;
    height: auto;
    position: relative;
    z-index: 10;
}

.config-card h2 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
}

.input-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-bottom: 0.4rem;
}

input,
select,
textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 0.7rem 1rem;
    color: white;
    font-size: 0.9rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 500px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

.btn {
    width: 100%;
    padding: 0.8rem;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Last Production Area */
.last-production-card {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.last-production-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .last-production-content {
        grid-template-columns: 1fr;
    }
}

.last-song-media img {
    width: 100%;
    border-radius: 15px;
    aspect-ratio: 1/1;
    object-fit: cover;
    margin-bottom: 1rem;
}

.players-area {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
}

.modern-player {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    padding: 12px;
    transition: all 0.3s ease;
}

.modern-player:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
}

.player-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.75rem;
    font-weight: 600;
}

.label-v1 {
    color: var(--accent);
}

.label-v2 {
    color: var(--primary);
}

audio {
    width: 100%;
    height: 35px;
    border-radius: 30px;
    filter: invert(100%) hue-rotate(180deg) brightness(1.5);
    /* Modern blue-ish skin */
}

.lyrics-preview {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: 10px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-size: 0.85rem;
    line-height: 1.6;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    overflow-y: auto;
    padding: 1rem;
}

.modal-content {
    background: #1e293b;
    margin: 2rem auto;
    padding: 1.5rem;
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
}

.history-table th,
.history-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

/* Action Buttons & History Mobile */
.actions-container {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.action-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.action-btn.btn-play {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.3);
}

.action-btn.btn-play.playing {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.action-btn.btn-download {
    background: rgba(56, 189, 248, 0.15);
    color: var(--accent);
    border-color: rgba(56, 189, 248, 0.3);
}

.action-btn.btn-view {
    background: rgba(131, 58, 180, 0.15);
    color: var(--primary);
    border-color: rgba(131, 58, 180, 0.3);
}

@media (max-width: 768px) {
    .history-table thead {
        display: none;
    }

    .history-table tr {
        display: block;
        background: rgba(255, 255, 255, 0.03);
        border-radius: 15px;
        margin-bottom: 15px;
        padding: 15px;
        border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .history-table td {
        display: block;
        padding: 8px 0;
        border: none;
        width: 100% !important;
    }

    .history-table td:before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        color: var(--text-dim);
        margin-bottom: 4px;
        text-transform: uppercase;
        font-weight: 700;
    }

    .actions-container {
        margin-top: 10px;
        justify-content: flex-start;
        gap: 12px;
    }

    .action-btn {
        width: 42px;
        height: 42px;
    }
}

/* Status Badges */
.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}

.status-success {
    background: var(--success);
    color: white;
}

.status-pending {
    background: var(--warning);
    color: #422006;
}

/* Autocomplete */
.search-box-container {
    position: relative;
}

.artist-autocomplete-results {
    position: absolute;
    top: 105%;
    left: 0;
    right: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.artist-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.artist-item:hover {
    background: rgba(131, 58, 180, 0.1);
}

.artist-item img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

/* Switch Toggle */
.switch-container {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    background: rgba(131, 58, 180, 0.2);
    padding: 15px;
    border-radius: 12px;
    border: 2px solid rgba(131, 58, 180, 0.4);
    margin: 1rem 0;
    cursor: pointer;
    visibility: visible;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #334155;
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background: var(--primary-gradient) !important;
}

input:checked+.slider:before {
    transform: translateX(18px);
}

/* Helpers */
.loading-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: none;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    padding: 60px 0;
    color: var(--text-dim);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.1);
}

/* Editor */
.lyrics-editor {
    background: var(--card-bg);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
}

.editor-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

textarea#lyricsText {
    min-height: 300px;
    font-family: monospace;
}

.editor-actions {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 500px) {
    .editor-actions {
        grid-template-columns: 1fr;
    }
}

/* Studio Progress */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: 20px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    width: 30%;
    background: var(--primary-gradient);
    border-radius: 10px;
    animation: loading-stretch 2s infinite ease-in-out;
}

@keyframes loading-stretch {
    0% {
        width: 0%;
        transform: translateX(0);
    }

    50% {
        width: 70%;
    }

    100% {
        width: 0%;
        transform: translateX(100%);
    }
}

.studio-loader-card h3 {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}