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

body {
    font-family: 'Manrope', 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #0F172A 100%);
    min-height: 100vh;
    padding: 24px;
    color: #E2E8F0;
}

.container {
    max-width: 920px;
    margin: 0 auto;
}

.main-content .card {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Заголовок — градиент, свечение */
.header {
    margin-bottom: 28px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.25), 0 4px 24px rgba(0, 0, 0, 0.3);
}

.header-content {
    text-align: center;
    background: linear-gradient(90deg, #6366F1 0%, #8B5CF6 50%, #A78BFA 100%);
    padding: 28px 40px;
    border-radius: 20px;
}

.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-content h1 {
    color: white;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 0;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.02em;
}

.header-title {
    color: white;
    text-decoration: none;
}

.header-title:hover {
    text-decoration: underline;
}

.header-nav {
    display: flex;
    gap: 20px;
    align-items: center;
}

.header-nav a {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
}

.header-nav a:hover {
    text-decoration: underline;
}

/* Подзаголовок не используется в V5 */

/* Карточки — стекло, тени, hover */
.card {
    background: rgba(30, 41, 59, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2), 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(148, 163, 184, 0.08);
}

.card h2 {
    color: #F8FAFC;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    padding-bottom: 10px;
    letter-spacing: -0.01em;
}

.card-hint {
    font-size: 13px;
    color: #94A3B8;
    margin-bottom: 16px;
    line-height: 1.5;
}

.options-group {
    margin-top: 16px;
}

.options-group.setting-group {
    display: flex;
    flex-direction: column;
}

#providerGroupSettings .setting-item {
    margin-top: 8px;
}

#providerGroupSettings textarea {
    width: 100%;
}

.options-group .checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 10px 0;
    font-size: 14px;
    color: #E2E8F0;
    transition: color 0.2s;
}

.options-group .checkbox-label:hover {
    color: #F8FAFC;
}

.options-group .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #6366F1;
}

/* Зона загрузки файла — подсветка, анимация */
.file-upload-area {
    position: relative;
    border: 2px dashed rgba(99, 102, 241, 0.5);
    border-radius: 16px;
    padding: 40px;
    text-align: center;
    background: rgba(15, 23, 42, 0.5);
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: #6366F1;
    background: rgba(99, 102, 241, 0.08);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2), 0 8px 24px rgba(99, 102, 241, 0.15);
}

.file-upload-area.dragover {
    border-color: #8B5CF6;
    background: rgba(139, 92, 246, 0.12);
    transform: scale(1.01);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.3), 0 12px 32px rgba(139, 92, 246, 0.2);
}

#fileInput {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.file-icon {
    font-size: 48px;
    filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.3));
}

.file-text {
    color: #94A3B8;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.2s;
}

.file-text.has-file {
    color: #34D399;
    font-weight: 600;
}

/* Настройки */
.setting-group {
    margin-bottom: 20px;
}

.setting-label {
    display: block;
    color: #E2E8F0;
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 14px;
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 14px;
    border-radius: 12px;
    transition: background 0.2s, color 0.2s;
    border: 1px solid transparent;
}

.radio-label:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #6366F1;
}

.radio-label span {
    color: #E2E8F0;
    font-size: 14px;
}

.setting-row {
    display: flex;
    gap: 24px;
    margin-top: 20px;
}

.setting-item {
    flex: 1;
}

.setting-item label {
    display: block;
    color: #E2E8F0;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.setting-item input,
.setting-item textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(15, 23, 42, 0.6);
    color: #F8FAFC;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    resize: vertical;
}

.setting-item input:focus,
.setting-item textarea:focus {
    outline: none;
    border-color: #6366F1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.setting-item input::placeholder,
.setting-item textarea::placeholder {
    color: #64748B;
}

/* Кнопки — градиент, свечение, актив */
.button-container {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin: 24px 0;
}

.btn {
    padding: 16px 44px;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    letter-spacing: -0.01em;
}

.btn-primary {
    background: linear-gradient(135deg, #6366F1 0%, #8B5CF6 100%);
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 0 28px rgba(99, 102, 241, 0.5), 0 8px 24px rgba(99, 102, 241, 0.3);
}

.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary:disabled {
    background: #475569;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: rgba(100, 116, 139, 0.4);
    color: #E2E8F0;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.btn-secondary:hover {
    background: rgba(71, 85, 105, 0.6);
    transform: translateY(-2px);
    border-color: rgba(148, 163, 184, 0.4);
}

.btn-accent {
    background: linear-gradient(135deg, #06B6D4 0%, #22D3EE 100%);
    color: #0F172A;
    box-shadow: 0 4px 16px rgba(6, 182, 212, 0.35);
}

.btn-accent:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 24px rgba(6, 182, 212, 0.45), 0 8px 24px rgba(6, 182, 212, 0.25);
}

.btn-accent:active {
    transform: scale(0.98);
}

/* Прогресс — градиент, капсула, свечение */
.progress-container {
    margin-top: 16px;
}

.progress-bar {
    width: 100%;
    height: 32px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366F1 0%, #8B5CF6 50%, #A78BFA 100%);
    width: 0%;
    transition: width 0.35s ease;
    border-radius: 999px;
    box-shadow: 0 0 16px rgba(99, 102, 241, 0.4);
}

/* Блок с текстовым прогрессом */
.progress-info {
    margin-bottom: 16px;
    padding: 18px 20px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.progress-row {
    margin-bottom: 8px;
    font-size: 14px;
    color: #E2E8F0;
}

.progress-row:last-child {
    margin-bottom: 0;
}

.progress-row strong {
    display: inline-block;
    min-width: 160px;
    color: #94A3B8;
    font-weight: 500;
}

/* Статус — скругление, иконки */
.status-message {
    text-align: center;
    padding: 18px 24px;
    margin: 24px 0;
    border-radius: 14px;
    font-weight: 600;
    font-size: 15px;
    display: none;
}

.status-message.success {
    background: rgba(52, 211, 153, 0.15);
    color: #34D399;
    border: 1px solid rgba(52, 211, 153, 0.4);
    display: block;
}

.status-message.error {
    background: rgba(239, 68, 68, 0.12);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
    display: block;
}

.status-message.info {
    background: rgba(99, 102, 241, 0.12);
    color: #A5B4FC;
    border: 1px solid rgba(99, 102, 241, 0.3);
    display: block;
}

/* Информационная панель — стекло */
.info-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.info-content-detailed {
    grid-template-columns: 1fr;
    gap: 20px;
}

.info-section {
    padding: 18px 20px;
    background: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.info-section strong {
    color: #F8FAFC;
    display: block;
    margin-bottom: 10px;
    font-size: 14px;
}

.info-section p {
    color: #94A3B8;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    color: #94A3B8;
    font-size: 13px;
    margin-bottom: 8px;
    padding-left: 22px;
    position: relative;
    line-height: 1.45;
}

.info-section li:before {
    content: "•";
    position: absolute;
    left: 0;
    color: #6366F1;
    font-weight: bold;
}

.info-section-result {
    margin-top: 8px;
}

/* Формы входа и регистрации */
.auth-card {
    max-width: 420px;
}

.auth-error {
    color: #F87171;
    font-size: 14px;
    margin-bottom: 16px;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

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

.auth-form label {
    display: block;
    color: #E2E8F0;
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.auth-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 10px;
    font-size: 14px;
    background: rgba(15, 23, 42, 0.6);
    color: #F8FAFC;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-form input:focus {
    outline: none;
    border-color: #6366F1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.auth-form .btn {
    margin-top: 8px;
}

.auth-hint {
    margin-top: 20px;
    font-size: 14px;
    color: #94A3B8;
}

.auth-hint a {
    color: #A5B4FC;
    text-decoration: none;
}

.auth-hint a:hover {
    text-decoration: underline;
}

/* Профиль */
.profile-email {
    font-size: 16px;
    color: #E2E8F0;
    margin-bottom: 8px;
}

.api-key-value {
    margin: 12px 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.25);
    overflow-x: auto;
}

.api-key-value code {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #A78BFA;
    user-select: all;
}

.api-docs-code {
    display: block;
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: #E2E8F0;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-x: auto;
    margin: 10px 0 16px;
}

.profile-hint,
.empty-hint {
    font-size: 14px;
    color: #94A3B8;
    line-height: 1.5;
}

.empty-hint a {
    color: #A5B4FC;
    text-decoration: none;
}

.empty-hint a:hover {
    text-decoration: underline;
}

.tasks-table-wrap {
    overflow-x: auto;
    margin-top: 16px;
}

.tasks-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.tasks-table th,
.tasks-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.tasks-table th {
    color: #94A3B8;
    font-weight: 600;
}

.tasks-table td {
    color: #E2E8F0;
}

.tasks-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.tasks-table .clickable-row {
    cursor: pointer;
}

.muted {
    color: #94A3B8;
    font-size: 13px;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.status-ok {
    background: rgba(52, 211, 153, 0.2);
    color: #34D399;
}

.status-badge.status-err {
    background: rgba(239, 68, 68, 0.2);
    color: #F87171;
}

.status-badge.status-pending {
    background: rgba(148, 163, 184, 0.2);
    color: #94A3B8;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* Адаптивность */
@media (max-width: 768px) {
    body {
        padding: 16px;
    }

    .info-content {
        grid-template-columns: 1fr;
    }

    .setting-row {
        flex-direction: column;
    }

    .header-content {
        padding: 22px 24px;
    }

    .header-content h1 {
        font-size: 24px;
    }

    .card {
        padding: 20px;
    }

    .btn {
        padding: 14px 32px;
        font-size: 15px;
    }
}

/* Фоновая музыка — виджет в шапке, рядом с «Профиль/Выйти» */
.music-widget {
    position: relative;
    display: flex;
    z-index: 50;
}

.music-toggle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s, border-color 0.2s;
}

.music-toggle:hover {
    transform: scale(1.06);
    background: rgba(255, 255, 255, 0.22);
}

.music-toggle.active {
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.3);
}

.music-panel {
    display: none;
    flex-direction: column;
    gap: 10px;
    width: 240px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(15, 23, 42, 0.97);
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: absolute;
    top: 44px;
    right: 0;
}

.music-panel.open {
    display: flex;
}

.music-track-name {
    font-size: 13px;
    font-weight: 600;
    color: #F8FAFC;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-controls {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.music-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(99, 102, 241, 0.12);
    color: #E2E8F0;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
}

.music-btn:hover {
    background: rgba(99, 102, 241, 0.28);
}

.music-volume-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.music-volume-row input[type="range"] {
    flex: 1;
    accent-color: #6366F1;
}

.music-attribution {
    font-size: 10px;
    color: #64748B;
    text-align: center;
    text-decoration: none;
}

.music-attribution:hover {
    color: #94A3B8;
}

@media (max-width: 600px) {
    .music-panel {
        width: 200px;
    }
}
