/* ============================================================
   styles.css — Медицинский протокол AI
   Единственный источник UI-стилей (исключая protocol.css для A4).
   Только используемые селекторы. Мёртвый код удалён.
   ============================================================ */

:root {
    --glass-bg: rgba(30, 27, 75, 0.65);
    --glass-border: rgba(255, 255, 255, 0.2);
    --primary-glow: rgba(138, 43, 226, 0.6);
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.85);
    --bg-deep: #0f0c29;
    --bg-mid: #302b63;
    --bg-light: #24243e;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
    /* Статичный градиент — без анимации, минимум GPU */
    background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-mid) 50%, var(--bg-light) 100%);
    background-attachment: fixed;
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Статичные фоновые пятна — без animation, без filter: blur() на body */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 15% 50%, rgba(138, 43, 226, 0.3) 0%, transparent 40%),
        radial-gradient(circle at 85% 30%, rgba(147, 51, 234, 0.25) 0%, transparent 40%),
        radial-gradient(circle at 50% 80%, rgba(72, 61, 139, 0.3) 0%, transparent 50%);
    z-index: -1;
    /* Убрали filter: blur(40px) и animation — главные причины GPU drain */
}

/* ---- Layout ---- */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 1;
}

/* App-specific override — A4 page needs more room */
.container--wide {
    max-width: 1400px;
}

.main-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    padding-bottom: 60px;
    align-items: start;
}

@media (min-width: 1200px) {
    .main-layout {
        grid-template-columns: 340px 1fr;
    }
}

/* ---- Glass Card ---- */

.glass {
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-top-color: rgba(255, 255, 255, 0.3);
    border-radius: 32px;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    /* Убран will-change: transform — не нужен для статичного элемента */
}

.glass-primary {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.25), rgba(75, 0, 130, 0.35));
    border-color: rgba(138, 43, 226, 0.5);
    box-shadow:
        0 0 30px rgba(138, 43, 226, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* Блик сверху */
.glass::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, transparent 100%);
    pointer-events: none;
    border-radius: 32px 32px 0 0;
}

/* ---- Shell Header ---- */

.shell-first-screen {
    display: flex;
    flex-direction: column;
}

.shell-header {
    padding: 40px 20px 24px;
    text-align: center;
    position: relative;
    z-index: 0;
}

/* Modifier: no bottom border, compact */
.shell-header--flat {
    border-bottom: none;
    padding-bottom: 0;
}

.shell-header h1 {
    font-size: 1.5em;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 0%, #e0c3fc 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.shell-description {
    font-size: 1em;
    color: var(--text-muted);
}

/* App-level overrides */
.page-title {
    font-size: 2.2em;
    margin-bottom: 10px;
}

.page-subtitle {
    font-size: 1.1em;
}

/* ---- Voice Input Card ---- */

.voice-card {
    padding: 30px;
    height: fit-content;
}

.voice-card__title {
    font-size: 1.5em;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
}

.voice-card__description {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 25px;
    font-size: 0.95em;
}

/* ---- CTA Button ---- */

.cta-button {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #8a2be2, #9333ea);
    color: white;
    padding: 20px 48px;
    border-radius: 50px;
    text-decoration: none;
    font-size: 1.3em;
    font-weight: 700;
    border: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
        0 12px 32px rgba(138, 43, 226, 0.6),
        0 0 0 1px rgba(138, 43, 226, 0.5);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s;
}

.cta-button:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow:
        0 20px 48px rgba(138, 43, 226, 0.7),
        0 0 0 1px rgba(138, 43, 226, 0.6);
}

.cta-button:hover::before {
    left: 100%;
}

/* CTA modifiers */
.cta-button--full {
    width: 100%;
    justify-content: center;
    font-size: 1.1em;
    padding: 15px;
}

.cta-button--small {
    padding: 10px 20px;
    font-size: 0.9em;
}

.cta-button--blue {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

/* ---- Secondary Button ---- */

.secondary-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

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

/* ---- Recording States ---- */

.raw-text-box {
    min-height: 100px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95em;
    white-space: pre-wrap;
    margin-top: 10px;
}

.status-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    color: #e0c3fc;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    margin-left: 10px;
    transition: background 0.3s, border-color 0.3s, color 0.3s, box-shadow 0.3s;
}

.status-badge.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.btn-recording {
    background: linear-gradient(135deg, #ef4444, #dc2626) !important;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.6) !important;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0%   { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70%  { box-shadow: 0 0 0 15px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

.spinner[hidden] {
    display: none;
}

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

/* ---- Voice Card Label ---- */

.voice-card__label {
    color: #e0c3fc;
}

/* ---- Form Elements ---- */

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.95em;
    color: var(--text-muted);
}

/* ---- Utility classes ---- */

.text-center { text-align: center; }
.mt-30 { margin-top: 30px; }
.mt-15 { margin-top: 15px; }
.flex-row { display: flex; gap: 10px; }

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .shell-header h1 { font-size: 0.9em; }
    .page-title { font-size: 1.8em; }
}

/* ---- Login Screen ---- */
.login-screen-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    background: linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-mid) 50%, var(--bg-light) 100%);
}

.login-screen-overlay[hidden] {
    display: none !important;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    margin: 20px;
    text-align: center;
}

.login-header h2 {
    font-size: 1.8em;
    margin-bottom: 10px;
    color: #fff;
}

.login-header p {
    color: var(--text-muted);
    margin-bottom: 30px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.login-form input:focus {
    border-color: #e0c3fc;
}

.login-error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.2);
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
}

/* ---- Header Profile Menu ---- */
.header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.header-spacer { flex: 1; }
.header-center { flex: 2; text-align: center; }
.header-right { flex: 1; display: flex; justify-content: flex-end; position: relative; padding-right: 20px; z-index: 1000;}

.profile-menu {
    position: relative;
    cursor: pointer;
    z-index: 1000;
}

.profile-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2em;
    transition: background 0.3s;
}

.profile-icon:hover {
    background: rgba(255, 255, 255, 0.2);
}

.profile-dropdown {
    position: absolute;
    top: 54px;
    right: 0;
    width: 220px;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
}

.profile-dropdown[hidden] {
    display: none !important;
}

.profile-info {
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 10px;
}

.profile-name {
    font-weight: 700;
    font-size: 1em;
    color: #fff;
    margin-bottom: 4px;
}

.profile-role {
    font-size: 0.85em;
    color: var(--text-muted);
}

.logout-btn {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fca5a5;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.4);
}
