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

:root {
    --bg-app: #0f172a;         /* Глубокий темный фон */
    --bg-panel: #1e293b;       /* Фон карточек и панелей */
    --bg-input: #334155;       /* Фон полей ввода */
    --text-main: #f1f5f9;      /* Основной текст */
    --text-muted: #94a3b8;     /* Вторичный текст */
    --primary: #6366f1;        /* Акцентный цвет (Индиго) */
    --primary-hover: #4f46e5;  /* Акцент при наведении */
    --danger: #ef4444;         /* Цвет удаления/ошибки */
    --success: #22c55e;        /* Цвет успеха */
    --border-radius: 12px;     /* Скругление углов */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    padding-bottom: 40px;
}

/* --- Layout & Typography --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.025em; margin-bottom: 1rem; }
h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
small { color: var(--text-muted); }

/* --- Header --- */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-panel);
    padding: 15px 25px;
    border-bottom: 1px solid #334155;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-info { font-weight: 600; display: flex; align-items: center; gap: 10px;}
.brand { font-size: 1.2rem; font-weight: 800; color: var(--primary); text-decoration: none; display: flex; align-items: center; gap: 8px;}

/* --- Buttons & Inputs --- */
button { cursor: pointer; font-family: inherit; transition: all 0.2s ease; }

.btn {
    padding: 10px 20px;
    border-radius: var(--border-radius);
    border: none;
    font-weight: 600;
    display: inline-flex; align-items: center; gap: 8px; justify-content: center;
}

.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-secondary { background: var(--bg-input); color: var(--text-main); }
.btn-secondary:hover { background: #475569; }
.btn-danger { background: var(--bg-input); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-icon { padding: 8px; border-radius: 50%; aspect-ratio: 1; }

input[type="text"], input[type="number"], input[type="file"], select, textarea {
    width: 100%;
    padding: 12px;
    border-radius: var(--border-radius);
    border: 1px solid #475569;
    background: var(--bg-input);
    color: var(--text-main);
    font-family: inherit;
    transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea.phrase-text { resize: vertical; min-height: 60px; font-size: 0.95rem; line-height: 1.4;}

/* --- Panels & Cards --- */
.panel {
    background: var(--bg-panel);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    border: 1px solid #334155;
}

/* --- Dashboard: Project Grid --- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.project-card {
    background: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 20px;
    border: 1px solid #334155;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 180px;
}
.project-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.proj-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 10px; color: white;}
.proj-meta { color: var(--text-muted); font-size: 0.9rem; flex-grow: 1; }
.proj-actions { display: flex; gap: 10px; margin-top: 20px; }
.proj-actions .btn { flex: 1; }

/* --- Editor Layout --- */
.editor-layout {
    display: grid;
    grid-template-columns: 1fr 350px; /* Основной контент слева, настройки справа */
    gap: 25px;
    align-items: start;
}
@media (max-width: 900px) { .editor-layout { grid-template-columns: 1fr; } }

/* --- Character Settings Cards --- */
.settings-grid { display: flex; flex-direction: column; gap: 15px; }
.char-card {
    background: var(--bg-input); /* Чуть темнее панели */
    padding: 15px;
    border-radius: var(--border-radius);
    border: 1px solid #475569;
}
.char-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.char-header h4 { margin: 0; color: var(--primary); }
.char-inputs { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-top: 10px; }
.char-inputs label { font-size: 0.8rem; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px;}

/* --- Phrase List --- */
.phrase-block {
    background: var(--bg-panel);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
    border-left: 5px solid var(--primary);
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.phrase-header { font-weight: 700; color: var(--primary); display: flex; justify-content: space-between; }
.phrase-id { color: var(--text-muted); font-weight: normal; font-size: 0.8rem; }
.phrase-footer {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-app); /* Темнее фон для плеера */
    padding: 10px;
    border-radius: var(--border-radius);
}
.custom-audio { height: 36px; flex-grow: 1; border-radius: var(--border-radius); outline: none;}
.no-audio { color: var(--text-muted); font-style: italic; flex-grow: 1; padding-left: 10px;}
.regen-btn-icon { 
    background: var(--bg-input); color: var(--text-main); 
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; border: 1px solid #475569; font-size: 1.2rem;
}
.regen-btn-icon:hover { background: var(--primary); border-color: var(--primary); transform: rotate(30deg); }

/* --- Console & Info --- */
.info-badge { 
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(99, 102, 241, 0.2); color: var(--primary); 
    padding: 8px 16px; border-radius: 20px; font-weight: 600; font-size: 0.9rem;
}
.console {
    background: #000; color: #22c55e;
    padding: 15px; border-radius: var(--border-radius);
    height: 150px; overflow-y: auto; font-family: monospace;
    font-size: 0.9rem; border: 1px solid #333; margin-top: 30px;
}

/* --- Utility --- */
.hidden { display: none !important; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.mb-4 { margin-bottom: 1rem; }

/* --- Индикация ошибок --- */
.phrase-error {
    border-left: 5px solid var(--danger) !important;
    background: rgba(239, 68, 68, 0.05) !important;
}

.status-success {
    background: rgba(34, 197, 94, 0.2) !important;
    color: var(--success) !important;
}

.status-danger {
    background: rgba(239, 68, 68, 0.2) !important;
    color: var(--danger) !important;
}