/*
Theme Name: PapayaBeat Theme
File: assets/css/app.css
Description: Tyylit käyttöliittymäkomponenteille, sovelluslogiikalle ja artistityökaluille.
Version: 2.1
*/

:root {
    --papaya-orange: #ff8c42;
    --papaya-orange-hover: #e67e3b;
    --papaya-dark: #121212;
    --papaya-panel: #1e1e1e;
    --papaya-border: #333333;
    --papaya-input-bg: #252525;
    --text-main: #ffffff;
    --text-muted: #888888;
    --app-padding: 20px;
}

/* --- 1. AMBIENT BACKGROUND --- */
.ambient-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
    background-color: #050505;
    pointer-events: none;
    transition: opacity 1s ease;
}

.ambient-background.hidden {
    opacity: 0;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.8;
    animation: floatOrb 12s infinite ease-in-out alternate;
}

.orb-1 {
    width: 70vw;
    height: 70vw;
    background: radial-gradient(circle, rgba(255, 140, 66, 0.5) 0%, rgba(255, 140, 66, 0) 70%);
    top: -15%;
    left: -15%;
    animation-delay: 0s;
}

.orb-2 {
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(200, 80, 20, 0.4) 0%, rgba(200, 80, 20, 0) 70%);
    bottom: -15%;
    right: -15%;
    animation-delay: -6s;
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, 60px) scale(1.15); }
}

/* --- 2. WELCOME SCREEN COMPONENTS --- */
.welcome-screen {
    background-color: transparent;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    opacity: 1;
    transition: opacity 1s ease-out;
}

.welcome-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.welcome-content {
    text-align: center;
    padding: var(--app-padding);
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    position: relative;
    z-index: 10;
}

.greeting-container {
    margin-bottom: 60px;
    min-height: 180px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.welcome-text {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 20px 0;
    line-height: 1.1;
    text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.welcome-desc {
    font-size: 1.3rem;
    color: #cccccc;
    font-weight: 400;
    max-width: 90%;
    opacity: 0;
    transform: translateY(15px);
    transition: all 0.8s ease;
    margin: 0;
    min-height: 1.5em;
    line-height: 1.4;
}

.welcome-desc.active {
    opacity: 1;
    transform: translateY(0);
}

/* --- 3. ANIMATIONS --- */
.welcome-word {
    display: none;
}
.welcome-word.active {
    display: inline-block;
    animation: wordFadeSlow 4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes wordFadeSlow {
    0% { opacity: 0; transform: scale(0.95) translateY(10px); }
    15% { opacity: 1; transform: scale(1) translateY(0); }
    85% { opacity: 1; transform: scale(1) translateY(0); }
    100% { opacity: 0; transform: scale(1.05) translateY(-10px); }
}

@keyframes brandEnter {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

/* --- 4. ACTION AREA --- */
.welcome-action {
    opacity: 1;
    transition: opacity 1s ease;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateY(0);
}

.welcome-action.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    max-width: 320px;
}

.papaya-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 20px 24px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    width: 100%;
    text-decoration: none;
    -webkit-appearance: none;
    line-height: 1;
}

.papaya-btn:active {
    transform: scale(0.98);
}

.papaya-btn-primary {
    background-color: var(--papaya-orange);
    color: #000;
    box-shadow: 0 4px 25px rgba(255, 140, 66, 0.5);
}

.papaya-btn-primary:hover {
    background-color: var(--papaya-orange-hover);
    box-shadow: 0 8px 30px rgba(255, 140, 66, 0.6);
    transform: translateY(-2px);
}

.papaya-link-secondary {
    color: var(--text-main);
    font-size: 0.95rem;
    margin-top: 15px;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 10px;
}

.papaya-link-secondary:hover {
    opacity: 1;
}

.legal-links {
    margin-top: 40px;
    font-size: 0.75rem;
    color: var(--text-faint);
}

.legal-links a {
    color: var(--text-faint);
    text-decoration: none;
    transition: color 0.2s;
}

.legal-links a:hover {
    color: var(--text-muted);
}

.legal-links .separator {
    margin: 0 8px;
    opacity: 0.3;
}

.papaya-app-container {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 10;
}

.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100%;
    background-color: var(--papaya-dark);
    position: absolute;
    top: 0;
    left: 0;
    z-index: 100;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--papaya-orange);
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* --- 5. SEARCH & GENRE STYLES --- */

/* Hakukenttä */
.search-bar-wrapper {
    position: relative;
    max-width: 400px;
    margin-top: 20px;
}

#app-search-input {
    width: 100%;
    padding: 14px 20px 14px 50px; /* Tilaa ikonille */
    border-radius: 50px;
    border: 1px solid #333;
    font-size: 1rem;
    background-color: #222; /* Tumma tausta */
    color: #fff; /* Valkoinen teksti */
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}

#app-search-input:focus {
    border-color: var(--papaya-orange);
    background-color: #2a2a2a;
}

.search-icon {
    position: absolute;
    top: 50%;
    left: 18px;
    transform: translateY(-50%);
    color: #888;
    font-size: 20px;
    pointer-events: none;
}

/* Genre Grid */
.genre-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.genre-box {
    padding: 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 1.2rem;
    color: #fff;
    min-height: 100px;
    display: flex;
    align-items: flex-start; /* Teksti vasempaan ylänurkkaan */
    transition: transform 0.2s;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.genre-box:hover {
    transform: scale(1.02);
}

/* Artist & Song Lists */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 24px;
    margin-top: 20px;
}

.artist-card {
    background: #181818;
    padding: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.artist-card:hover {
    background-color: #282828;
}

.card-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    border-radius: 50%; /* Artistit pyöreinä */
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.card-info h4 {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-info span {
    color: #b3b3b3;
    font-size: 0.85rem;
}

/* Song Rows (Hakutulokset) */
.song-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.song-row {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.song-row:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.song-cover {
    width: 48px;
    height: 48px;
    margin-right: 16px;
    flex-shrink: 0;
}
.song-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.song-details {
    flex-grow: 1;
    overflow: hidden;
}

.song-title {
    color: #fff;
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-artist {
    color: #b3b3b3;
    font-size: 0.85rem;
}

.song-action {
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
}
.song-row:hover .song-action {
    opacity: 1;
}

/* HQ Badge */
.hq-badge {
    background: #333;
    color: #aaa;
    font-size: 0.6rem;
    padding: 2px 4px;
    border-radius: 3px;
    margin-left: 6px;
    border: 1px solid #444;
    vertical-align: middle;
}

/* --- 6. ARTIST STUDIO (UPDATED FOR v2.1) --- */

/* Keskitetty lomakealue */
.papaya-studio-wrapper {
    max-width: 900px;
    margin: 40px auto;
    padding: 40px;
    background-color: #181818;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    border: 1px solid #333;
    box-sizing: border-box;
}

/* Kaksipalstainen gridi */
.studio-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 40px;
}

/* Vasen: Kuvan lataus */
.file-upload-box {
    width: 100%;
    aspect-ratio: 1/1;
    background-color: #222;
    border: 2px dashed #444;
    border-radius: 12px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: border-color 0.2s;
}

.file-upload-box:hover {
    border-color: var(--papaya-orange);
}

.file-upload-box input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.upload-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #888;
    width: 100%;
    pointer-events: none;
}

.upload-placeholder .dashicons {
    font-size: 40px;
    height: 40px;
    width: 40px;
    margin-bottom: 10px;
}

.image-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    display: none;
    z-index: 1;
}

/* Oikea: Lomakekentät */
.studio-label {
    display: block;
    color: var(--papaya-orange);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.studio-input {
    width: 100%;
    background-color: #252525;
    border: 1px solid transparent;
    color: #fff;
    padding: 14px 16px;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s;
    box-sizing: border-box; /* Varmistaa, että padding ei levitä kenttää */
}

.studio-input:focus {
    background-color: #333;
    border-color: var(--papaya-orange);
    outline: none;
}

.studio-input.large {
    font-size: 1.3rem;
    font-weight: 700;
}

.form-group {
    margin-bottom: 25px;
}

.form-row {
    display: flex;
    gap: 20px;
}
.form-group.half {
    width: 50%;
}

/* Biisin latausalueen korjaus */
.studio-file-input-wrapper {
    position: relative;
    background: #222;
    border: 2px dashed #444;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    transition: all 0.2s;
}

.studio-file-input-wrapper:hover {
    border-color: var(--papaya-orange);
    background: #252525;
}

.studio-file-input-wrapper input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
}

.studio-submit-btn {
    background-color: var(--papaya-orange);
    color: #000;
    border: none;
    width: 100%;
    padding: 16px;
    font-size: 1.1rem;
    font-weight: 800;
    border-radius: 50px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 20px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.studio-submit-btn:hover {
    background-color: var(--papaya-orange-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(255, 140, 66, 0.3);
}

.papaya-alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}
.papaya-alert.success {
    background: #1e3a20;
    color: #4caf50;
    border: 1px solid #4caf50;
}
.papaya-alert.error {
    background: #3a1616;
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
}

/* Spinner Animation (General) */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsiivisuus */
@media (max-width: 800px) {
    .studio-grid {
        grid-template-columns: 1fr;
    }
    .file-upload-box {
        max-width: 300px;
        margin: 0 auto;
    }
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    .form-group.half {
        width: 100%;
    }
}
