/* Стили для основного приложения SwagPlayer */

:root {
    --bg-color: #000000;
    --card-bg: #121212;
    --card-border: transparent;
    --accent: #fa2d48;
}

body {
    background-color: var(--bg-color);
}

.bg-noise {
    display: none;
}

/* ЭКРАН АВТОРИЗАЦИИ */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.auth-container {
    text-align: center;
    padding: 40px 20px;
    max-width: 400px;
    width: 100%;
}

.auth-header h1 {
    font-size: 48px;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fa2d48 0%, #ff6b9d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-header p {
    color: rgba(255,255,255,0.6);
    font-size: 16px;
    margin-bottom: 40px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: #fa2d48;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.auth-error {
    color: #ff453a;
}

.auth-error ion-icon {
    font-size: 48px;
    margin-bottom: 20px;
}

/* ГЛАВНОЕ ПРИЛОЖЕНИЕ */
.main-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #000;
    color: #fff;
    padding-bottom: 200px; /* Увеличено для миниплеера и прокрутки */
    overflow-y: visible;
    height: auto;
}

/* НАВИГАЦИЯ */
.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #1c1c1e;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 1000; /* Ниже миниплеера (z-index: 1500), но выше обычного контента */
    padding-bottom: max(8px, env(safe-area-inset-bottom, 8px));
}

/* Миниплеер должен быть НАД навигацией ТОЛЬКО в приложении /app */
/* Используем data-page="app" который устанавливается в app.html */
body[data-page="app"] .mini-player {
    z-index: 1500 !important; /* ВЫШЕ навигации (z-index: 1000), но НИЖЕ модалок (10000+) */
    bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important; /* Навигация (85px) - прямо над навигацией */
    position: fixed !important;
}

/* Для мобильных в /app */
@media (max-width: 767px) {
    body[data-page="app"] .mini-player {
        bottom: calc(85px + env(safe-area-inset-bottom, 0px)) !important;
        left: 10px !important;
        right: 10px !important;
    }
}

/* Для десктопа в /app - центрируем как на других страницах */
@media (min-width: 768px) {
    body[data-page="app"] .mini-player {
        left: 50% !important;
        transform: translate(-50%, 0) !important;
        right: auto !important;
        max-width: 1200px !important;
        width: calc(100% - 40px) !important;
    }
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: color 0.2s;
}

.nav-item.active {
    color: #fa2d48;
}

.nav-item ion-icon {
    font-size: 24px;
}

.nav-item span {
    font-size: 11px;
}

/* ШАПКА */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    padding-top: max(15px, env(safe-area-inset-top, 15px));
    background: #000;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.app-header .header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.app-header h1 {
    flex: 1;
}

.app-header h1 {
    font-size: 28px;
    font-weight: 800;
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:active {
    background: rgba(255,255,255,0.2);
}

/* КОНТЕНТ */
.app-content {
    flex: 1;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 100px; /* Дополнительное пространство для прокрутки */
}

.page {
    display: none;
    padding: 20px;
    padding-bottom: 100px;
}

.page.active {
    display: block;
}

/* СТАТИСТИКА */
.library-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.stat-card {
    background: #1c1c1e;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-card ion-icon {
    font-size: 32px;
    color: #fa2d48;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
}

/* СЕТКА ТРЕКОВ */
.tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.track-card {
    background: #1c1c1e;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.track-card:active {
    transform: scale(0.98);
    background: #2c2c2e;
}

.track-card-cover {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: #333;
}

.track-card-info {
    padding: 12px;
}

.track-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-card-artist {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.track-card-actions {
    display: flex;
    gap: 5px;
    padding: 8px 12px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.track-card-actions button {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

/* ФОРМА ЗАГРУЗКИ */
.upload-form {
    max-width: 600px;
    margin: 0 auto;
}

.upload-form h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: #1c1c1e;
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 12px;
    border-radius: 10px;
    font-size: 16px;
    font-family: inherit;
    box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #fa2d48;
}

.form-group small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
}

.file-info {
    margin-top: 8px;
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

.cover-preview {
    margin-top: 10px;
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    background: #1c1c1e;
}

.cover-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-primary,
.btn-secondary,
.btn-danger {
    background: #fa2d48;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary:active {
    background: #d41e36;
}

.btn-primary.btn-large {
    width: 100%;
    justify-content: center;
    padding: 16px;
    font-size: 18px;
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
}

.btn-secondary:active {
    background: rgba(255,255,255,0.2);
}

.btn-danger {
    background: #ff453a;
}

.btn-danger:active {
    background: #d41e36;
}

/* АЛЬБОМЫ */
.albums-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.albums-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.album-card {
    background: #1c1c1e;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.album-card:active {
    transform: scale(0.98);
}

.album-card-cover {
    width: 100%;
    aspect-ratio: 1/1;
    object-fit: cover;
    background: linear-gradient(135deg, #333 0%, #1c1c1e 100%);
}

.album-card-info {
    padding: 12px;
}

.album-card-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
}

.album-card-description {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ПРОФИЛЬ */
.profile-card {
    max-width: 500px;
    margin: 0 auto;
    background: #1c1c1e;
    border-radius: 16px;
    padding: 30px;
    text-align: center;
}

.profile-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    position: relative;
    overflow: hidden;
    background: #333;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    color: rgba(255,255,255,0.3);
}

.profile-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-nickname {
    color: rgba(255,255,255,0.6);
    font-size: 16px;
    margin-bottom: 30px;
}

.profile-info {
    text-align: left;
    margin-bottom: 20px;
}

.info-item {
    margin-bottom: 20px;
}

.info-item label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
}

.info-item input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    color: white;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

.share-link {
    display: flex;
    gap: 10px;
}

.share-link input {
    flex: 1;
}

/* МОДАЛЬНЫЕ ОКНА */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px);
    z-index: 10000; /* Выше всего: миниплеера (1500), фуллплеера (2000), навигации (1000) */
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1c1c1e;
    border-radius: 20px;
    padding: 25px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    z-index: 10001; /* Выше модального overlay (10000) */
    pointer-events: auto;
}

.modal-large .modal-content {
    max-width: 900px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.form-actions button {
    flex: 1;
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: rgba(255,255,255,0.4);
}

.empty-state ion-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.3;
}

.empty-state p {
    font-size: 16px;
    margin-bottom: 20px;
}

/* LYRICS STUDIO (как в админке) */
.lyrics-studio {
    display: flex;
    flex-direction: column;
    height: 500px;
    gap: 15px;
    flex: 1;
    min-height: 0;
}

.ls-controls {
    display: flex;
    gap: 10px;
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 10px;
    align-items: center;
    flex-wrap: nowrap;
}

#ls-time-display {
    font-family: monospace;
    min-width: 70px;
    flex-shrink: 0;
    text-align: center;
    color: white;
}

#ls-seek {
    flex: 1;
    min-width: 0;
}

.ls-editor-container {
    display: flex;
    flex: 1;
    gap: 15px;
    min-height: 0;
}

.ls-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}

.ls-header {
    padding: 10px;
    background: rgba(255,255,255,0.05);
    font-size: 12px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.6);
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ls-input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 15px;
    resize: none;
    font-family: monospace;
    line-height: 1.5;
    font-size: 14px;
}

.ls-timeline {
    flex: 1;
    overflow-y: auto;
    padding: 5px 0 0 0;
}

.ls-line {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    cursor: pointer;
    display: flex;
    gap: 10px;
    align-items: center;
    transition: background 0.1s;
}
.ls-line:hover { background: rgba(255,255,255,0.05); }
.ls-line.active { background: rgba(250, 45, 72, 0.2); border-left: 3px solid var(--accent); }

.ls-time {
    font-family: monospace;
    color: var(--accent);
    font-size: 13px;
    min-width: 80px;
    flex-shrink: 0;
    user-select: none;
}
.ls-time-input {
    font-family: monospace;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 13px;
    min-width: 80px;
    flex-shrink: 0;
}
.ls-text { 
    flex: 1; 
    font-size: 14px; 
    min-width: 0;
    word-break: break-word;
    padding-right: 5px;
}
.ls-text-input {
    flex: 1;
    background: rgba(255,255,255,0.1);
    border: 1px solid var(--accent);
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
}
.ls-actions {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}
.ls-btn-small {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}
.ls-btn-small:hover { background: rgba(255,255,255,0.2); }

.ls-guide {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    border-left: 3px solid var(--accent);
}
.ls-guide ol {
    margin: 5px 0 0 20px;
    padding: 0;
}
.ls-guide li {
    margin-bottom: 4px;
}

.btn-ls-action {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.2s;
}
.btn-ls-action:hover { background: rgba(255, 255, 255, 0.2); }
.btn-ls-action.primary { background: var(--accent); color: white; }
.btn-ls-action.primary:hover { background: #d41e36; }

.btn-sync-large {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 50%;
    width: 60px; height: 60px;
    font-size: 24px;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 5px 15px rgba(250, 45, 72, 0.4);
    margin-left: auto;
    cursor: pointer;
}
.btn-sync-large:active { transform: scale(0.9); }

.action-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    width: 40px; height: 40px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}
.action-btn:hover { background: rgba(255,255,255,0.2); }

/* АДАПТАЦИЯ */
@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .tracks-grid,
    .albums-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .nav-item span {
        font-size: 10px;
    }
    
    .lyrics-studio-main {
        grid-template-columns: 1fr;
    }
}

/* Скрытые треки */
.track-like-btn, .album-like-btn {
    transition: color 0.2s;
}

.track-like-btn.liked, .album-like-btn.liked {
    color: #fa2d48;
}

.track-like-btn.liked ion-icon, .album-like-btn.liked ion-icon {
    fill: #fa2d48;
}

.track-hidden {
    opacity: 0.6;
    position: relative;
}

.track-hidden::after {
    content: 'Скрыт';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    pointer-events: none;
}
