/* Страница настроек: контент выше футера, футер остаётся видимым */
.settings-screen {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 64px;
    width: 100%;
    background: #121212;
    z-index: 1500;
    overflow: hidden;
    flex-direction: column;
}

.settings-screen.active {
    display: flex;
}

body.settings-open {
    overflow: hidden;
}

body.light-theme .settings-screen {
    background: #f8fafc;
}

.settings-screen-header {
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    background: #121212;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-theme .settings-screen-header {
    background: #f8fafc;
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.settings-screen-header-row {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 56px;
    padding: 0 16px;
}

.settings-screen-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #f1f5f9;
}

body.light-theme .settings-screen-title {
    color: #1e293b;
}

/* Блоки в контенте настроек */
.settings-section {
    margin-bottom: 28px;
}

.settings-section-title {
    margin: 0 0 10px;
    padding: 0 4px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #94a3b8;
}

body.light-theme .settings-section-title {
    color: #64748b;
}

.settings-block {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

body.light-theme .settings-block {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.08);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 18px;
    font-size: 16px;
    font-weight: 500;
    color: #e2e8f0;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: background 0.15s ease;
    text-align: left;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.settings-row:active {
    background: rgba(255, 255, 255, 0.08);
}

body.light-theme .settings-row {
    color: #1e293b;
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.light-theme .settings-row:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.light-theme .settings-row:active {
    background: rgba(0, 0, 0, 0.06);
}

.settings-row-danger:hover {
    background: rgba(239, 68, 68, 0.12);
}

body.light-theme .settings-row-danger:hover {
    background: rgba(239, 68, 68, 0.08);
}

.settings-row-label {
    flex: 1;
}

.settings-row-icon {
    font-size: 22px;
    color: #64748b;
}

body.light-theme .settings-row-icon {
    color: #94a3b8;
}

.settings-row-danger .settings-row-icon {
    color: #f87171;
}

body.light-theme .settings-row-danger .settings-row-icon {
    color: #dc2626;
}

/* Строка с переключателем (не кнопка) */
.settings-row-with-toggle {
    cursor: default;
}

.settings-row-with-theme {
    cursor: default;
}

.settings-row-with-toggle:hover {
    background: transparent;
}

.settings-row-with-toggle:active {
    background: transparent;
}

.settings-row-with-select {
    cursor: default;
}

.settings-row-with-select:hover {
    background: transparent;
}

.settings-select {
    padding: 8px 32px 8px 12px;
    font-size: 15px;
    font-weight: 500;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 20px;
}

body.light-theme .settings-select {
    color: #1e293b;
    background-color: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.12);
}

.settings-row-with-voice-lang {
    cursor: default;
}

.settings-row-with-voice-lang:hover {
    background: transparent;
}

.settings-voice-lang-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.settings-voice-lang-wrap .settings-select {
    min-width: 140px;
}

.settings-input {
    width: 6em;
    min-width: 5em;
    padding: 8px 12px;
    font-size: 15px;
    font-weight: 500;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    box-sizing: border-box;
}

.settings-input::placeholder {
    color: #64748b;
}

body.light-theme .settings-input {
    color: #1e293b;
    background-color: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .settings-input::placeholder {
    color: #94a3b8;
}

.settings-row-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.settings-row-desc {
    font-size: 13px;
    font-weight: 400;
    color: #94a3b8;
    line-height: 1.35;
}

body.light-theme .settings-row-desc {
    color: #64748b;
}

/* Переключатель (toggle switch) */
.settings-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
}

.settings-toggle-input {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.settings-toggle-track {
    position: relative;
    width: 50px;
    height: 30px;
    border-radius: 15px;
    background: #334155;
    transition: background 0.2s ease;
}

.settings-toggle-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.settings-toggle-input:checked + .settings-toggle-track {
    background: #38bdf8;
}

.settings-toggle-input:checked + .settings-toggle-track::after {
    transform: translateX(20px);
}

body.light-theme .settings-toggle-track {
    background: #cbd5e1;
}

body.light-theme .settings-toggle-track::after {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

body.light-theme .settings-toggle-input:checked + .settings-toggle-track {
    background: #0ea5e9;
}

/* Диалоги подтверждения в настройках */
.settings-dialog {
    display: none;
    position: absolute;
    inset: 0;
    z-index: 20;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.settings-dialog.active {
    display: flex;
}

.settings-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.settings-dialog-box {
    position: relative;
    background: #1e293b;
    color: #f1f5f9;
    padding: 24px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-width: 280px;
    max-width: 340px;
}

body.light-theme .settings-dialog-box {
    background: #fff;
    color: #1e293b;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

.settings-dialog-text {
    margin: 0 0 24px;
    font-size: 15px;
    line-height: 1.5;
    color: #cbd5e1;
}

body.light-theme .settings-dialog-text {
    color: #475569;
}

.settings-dialog-text-small {
    margin-top: -12px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #94a3b8;
}

body.light-theme .settings-dialog-text-small {
    color: #64748b;
}

.settings-dialog-input {
    display: block;
    width: 100%;
    margin-bottom: 20px;
    padding: 10px 14px;
    font-size: 15px;
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-sizing: border-box;
}

.settings-dialog-input::placeholder {
    color: #64748b;
}

body.light-theme .settings-dialog-input {
    color: #1e293b;
    background: #f1f5f9;
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-theme .settings-dialog-input::placeholder {
    color: #94a3b8;
}

.settings-dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.settings-dialog-btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.settings-dialog-btn-primary {
    background: #38bdf8;
    color: #0f172a;
}

.settings-dialog-btn-primary:hover {
    background: #7dd3fc;
}

.settings-dialog-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.settings-dialog-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #94a3b8;
}

.settings-dialog-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

body.light-theme .settings-dialog-btn-primary {
    background: #0ea5e9;
    color: #fff;
}

body.light-theme .settings-dialog-btn-primary:hover {
    background: #0284c7;
}

body.light-theme .settings-dialog-btn-primary:disabled {
    opacity: 0.5;
}

body.light-theme .settings-dialog-btn-secondary {
    background: #f1f5f9;
    color: #64748b;
}

body.light-theme .settings-dialog-btn-secondary:hover {
    background: #e2e8f0;
    color: #334155;
}

.settings-dialog-btn-danger {
    background: #dc2626;
    color: #fff;
}

.settings-dialog-btn-danger:hover {
    background: #b91c1c;
}

.settings-dialog-btn-danger:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

body.light-theme .settings-dialog-btn-danger:hover {
    background: #b91c1c;
}

body.light-theme .settings-dialog-btn-danger:disabled {
    opacity: 0.5;
}

.settings-screen-phone {
    position: relative;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: auto;
}

.settings-screen-phone-inner {
    padding: 20px;
    padding-bottom: 96px;
    min-height: 100%;
    color: #e2e8f0;
}

body.light-theme .settings-screen-phone-inner {
    color: #1e293b;
}
