/* ============================================================
   TOCHNO.LIFE PWA — BRANDBOOK STYLE
   Core styles: auth screens, layout, typography
   ============================================================ */

/* === ПОДКЛЮЧЕНИЕ ЛОКАЛЬНЫХ ШРИФТОВ PP PANGRAM SANS === */
@font-face {
    font-family: 'PPPangramSans';
    src: url('/inv/app/fonts/PPPangramSans-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'PPPangramSans';
    src: url('/inv/app/fonts/PPPangramSans-LightItalic.ttf') format('truetype');
    font-weight: 300;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'PPPangramSans';
    src: url('/inv/app/fonts/PPPangramSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'PPPangramSans';
    src: url('/inv/app/fonts/PPPangramSans-RegularItalic.ttf') format('truetype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'PPPangramSans';
    src: url('/inv/app/fonts/PPPangramSans-Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'PPPangramSans';
    src: url('/inv/app/fonts/PPPangramSans-MediumItalic.ttf') format('truetype');
    font-weight: 500;
    font-style: italic;
    font-display: swap;
}
@font-face {
    font-family: 'PPPangramSans';
    src: url('/inv/app/fonts/PPPangramSans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'PPPangramSans';
    src: url('/inv/app/fonts/PPPangramSans-BoldItalic.ttf') format('truetype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

:root {
    /* === ЦВЕТОВАЯ ПАЛИТРА BRANDBOOK TOCHNO === */
    /* Precision Graphite — основной тёмный #1E1E1E */
    --primary-color: #4773FC;        /* Creative Lightning Indigo */
    --primary-dark: #3560E0;         /* Indigo hover */
    --primary-light: #EDF0FF;        /* Indigo 10% tint */

    --bg-color: #FFFFFF;             /* Pure White */
    --card-bg: #FFFFFF;              /* Pure White */
    --text-main: #1E1E1E;            /* Precision Graphite */
    --text-secondary: #666666;       /* Вторичный текст */
    --text-light: #999999;           /* Светлый текст */

    --danger-color: #E73B0F;         /* Energy Lava Red */
    --danger-light: #FFEBE5;         /* Red 10% tint */
    --success-color: #00B46F;        /* Care Emerald */
    --success-light: #E6F8F1;        /* Emerald 10% tint */
    --warning-color: #FF9800;
    --warning-light: #FFF3E0;

    --border-color: #DDDDDD;         /* Границы */
    --border-light: #F0F0F0;
    --input-bg: #F8F8F8;             /* Фон полей ввода */

    /* Тени — на основе Precision Graphite */
    --shadow-sm: 0 1px 3px rgba(30, 30, 30, 0.06);
    --shadow-md: 0 4px 12px rgba(30, 30, 30, 0.08);
    --shadow-lg: 0 8px 24px rgba(30, 30, 30, 0.10);

    /* Радиусы */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
* {
    box-sizing: border-box;
}

body {
    font-family: 'PPPangramSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    background-color: var(--bg-color);
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color: var(--text-main);
    font-size: 15px;
    line-height: 1.5;
}

.global-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
}

.hidden {
    display: none !important;
}

/* ============================================================
   AUTH CONTAINER — общий для всех экранов авторизации
   ============================================================ */
.container {
    text-align: center;
    background: var(--card-bg);
    padding: 48px 40px;
    border-radius: 0;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
    max-width: 420px;
    width: 90%;
    transition: all 0.3s ease;
    position: relative;
}

/* ============================================================
   LOGO — брендбук: логотип слева вверху
   ============================================================ */
.login-logo {
    position: absolute;
    top: 20px;
    left: 24px;
    height: 28px;
    width: auto;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 {
    margin-bottom: 24px;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
    font-family: 'PPPangramSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 16px;
    font-family: 'PPPangramSans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.3px;
}

p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 14px;
    line-height: 1.55;
    font-weight: 400;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.login-form {
    max-width: 340px;
    margin: 0 auto;
    padding: 8px 0;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-main);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-family: 'PPPangramSans', sans-serif;
}

.form-group input {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 0;
    font-size: 16px;
    font-family: 'PPPangramSans', sans-serif;
    box-sizing: border-box;
    background: var(--input-bg);
    color: var(--text-main);
    transition: all 0.2s;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-group input:hover {
    border-color: #999999;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--card-bg);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.form-group input::placeholder {
    color: var(--text-light);
    font-weight: 400;
}

/* ============================================================
   BUTTONS
   ============================================================ */

/* Primary action button — Creative Lightning Indigo */
.btn-login,
.btn-register {
    width: 100%;
    padding: 18px;
    background: var(--primary-color);
    color: #FFFFFF;
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
    letter-spacing: 0.5px;
    font-family: 'PPPangramSans', sans-serif;
}

.btn-login:hover,
.btn-register:hover {
    background: var(--primary-dark);
}

.btn-login:active,
.btn-register:active {
    transform: scale(0.98);
}

/* Success button — Care Emerald */
.btn-primary {
    width: 100%;
    padding: 18px;
    background: var(--success-color);
    color: #FFFFFF;
    border: none;
    border-radius: 0;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 12px;
    letter-spacing: 0.5px;
    font-family: 'PPPangramSans', sans-serif;
}

.btn-primary:hover {
    background: #009a5e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 180, 111, 0.3);
}

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

/* Logout / secondary button */
.btn-logout {
    width: 100%;
    margin-top: 20px;
    padding: 16px 24px;
    background-color: var(--text-main);
    color: #FFFFFF;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s;
    font-family: 'PPPangramSans', sans-serif;
    letter-spacing: 0.3px;
}

.btn-logout:hover {
    background-color: #333333;
}

/* ============================================================
   LINKS — брендбук: чистые sans-serif ссылки, не italic
   ============================================================ */
.register-link,
.forgot-password-link,
.back-to-login-link {
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
    font-family: 'PPPangramSans', sans-serif;
    border-bottom: 1px solid transparent;
}

.register-link:hover,
.forgot-password-link:hover,
.back-to-login-link:hover {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.auth-links {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 16px;
}

/* ============================================================
   MESSAGES — ошибки и успех
   ============================================================ */

/* Error message — Energy Lava Red */
.error-message {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--danger-light);
    color: var(--danger-color);
    border-radius: 0;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(231, 59, 15, 0.2);
}

/* Success message — Care Emerald */
.success-message {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--success-light);
    color: var(--success-color);
    border-radius: 0;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(0, 180, 111, 0.2);
}

/* Generic message */
.message {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 0;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

.message.error {
    background: var(--danger-light);
    color: var(--danger-color);
    border: 1px solid rgba(231, 59, 15, 0.2);
}

.message.success {
    background: var(--success-light);
    color: var(--success-color);
    border: 1px solid rgba(0, 180, 111, 0.2);
}

/* ============================================================
   ICON BUTTON
   ============================================================ */
.icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 5px;
}

/* ============================================================
   APP MODE — основной интерфейс после авторизации
   ============================================================ */
body.app-mode {
    align-items: flex-start;
    background-color: #FFFFFF;
}

.app-screen {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background: #FFFFFF;
    position: relative;
    box-shadow: 0 0 20px rgba(30, 30, 30, 0.05);
    min-height: 100vh;
    min-height: 100dvh;
    height: auto;
}

/* ============================================================
   PENDING APPROVAL SCREEN — брендбук: Care Emerald + Indigo
   ============================================================ */

.pending-container {
    border: 2px solid var(--success-color);
    background: linear-gradient(180deg, #FFFFFF 0%, var(--success-light) 100%);
    padding: 40px 32px;
}

.pending-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: pulse 2s ease-in-out infinite;
}

.pending-icon-success {
    font-size: 64px;
    margin-bottom: 16px;
    animation: checkmark 0.6s ease-out;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes checkmark {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.pending-container h2 {
    color: var(--success-color);
    font-size: 24px;
    margin-bottom: 16px;
}

.pending-text {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 20px;
    font-weight: 400;
}

.pending-info {
    margin: 20px 0;
}

/* Info badge — Creative Lightning Indigo */
.info-badge {
    display: inline-block;
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

/* Mascot variant */
.pending-mascot {
    position: relative;
    margin-bottom: 24px;
}

.mascot-face {
    font-size: 72px;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.mascot-bubble {
    background: var(--primary-light);
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    color: var(--primary-color);
    margin-top: 8px;
    position: relative;
    font-weight: 500;
}

.mascot-bubble::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--primary-light);
}

/* Status steps */
.status-steps {
    margin: 24px 0;
    text-align: left;
}

.step {
    padding: 10px 16px;
    margin: 8px 0;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    background: var(--input-bg);
    font-weight: 400;
}

.step.completed {
    background: var(--success-light);
    color: var(--success-color);
    font-weight: 500;
}

.step.active {
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
    animation: highlight 1.5s ease-in-out infinite;
}

@keyframes highlight {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Details variant */
.pending-details {
    background: var(--input-bg);
    border-radius: var(--radius-md);
    padding: 16px;
    margin: 20px 0;
    text-align: left;
    border: 1px solid var(--border-light);
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

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

.detail-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    color: var(--text-main);
    font-weight: 600;
    text-align: right;
}

.detail-value.status-waiting {
    color: var(--warning-color);
}

/* ============================================================
   ACCESS DENIED / ERROR SCREEN — Energy Lava Red
   ============================================================ */

.error-container {
    border: 2px solid var(--danger-color);
    background-color: var(--danger-light);
}

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

#access-denied-screen h2 {
    color: var(--danger-color);
}

.sub-text {
    font-size: 13px;
    color: var(--text-light);
    margin-top: -8px;
    font-weight: 400;
}

/* ============================================================
   VARIANT STYLES (альтернативные стили pending screen)
   ============================================================ */

/* Вариант с маскотом — Creative Lightning Indigo */
.pending-container.variant-mascot {
    border-color: var(--primary-color);
    background: linear-gradient(180deg, #FFFFFF 0%, var(--primary-light) 100%);
}

.pending-container.variant-mascot h2 {
    color: var(--primary-color);
}

.pending-container.variant-mascot .info-badge {
    background: var(--success-light);
    color: var(--success-color);
}

/* Вариант Success — Care Emerald */
.pending-container.variant-success {
    border-color: var(--success-color);
    background: linear-gradient(180deg, #FFFFFF 0%, var(--success-light) 100%);
}

.pending-container.variant-success h2 {
    color: var(--success-color);
}

.pending-container.variant-success .pending-icon-success {
    font-size: 80px;
}

/* ============================================================
   MEDIA QUERIES
   ============================================================ */
@media (min-width: 600px) {
    body {
        background-color: #FFFFFF;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 36px 24px;
    }

    h1 {
        font-size: 24px;
    }

    .login-logo {
        top: 16px;
        left: 20px;
        height: 24px;
    }
}