/* ============================================
   СТИЛЬ ДЛЯ ЖК "САН-СИТИ" — СОВРЕМЕННЫЙ
   ============================================ */

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

:root {
    --gold: #C9A84C;
    --gold-light: #E8D5A3;
    --gold-dark: #A8893A;
    --white: #FFFFFF;
    --text-light: rgba(255, 255, 255, 0.9);
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-dim: rgba(255, 255, 255, 0.3);
    --shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-image: url('/static/images/building.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
    transition: background-position 0.1s ease-out;
    font-weight: 500;
    letter-spacing: -0.01em;
    background-color: #0B2B4A;
}

body::before {
    content: '';
    position: fixed;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background-image: url('/static/images/building.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    filter: blur(8px) brightness(0.7);
    z-index: -1;
}

/* ============================================
   ПРИВЕТСТВЕННЫЙ ЭКРАН
   ============================================ */
#splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(0px);
    -webkit-backdrop-filter: blur(0px);
    background: rgba(10, 22, 40, 0.0);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#splash-screen.fade-out {
    opacity: 0;
    transform: scale(1.05);
    pointer-events: none;
}

.splash-content {
    text-align: center;
    transition: transform 0.1s ease-out;
    will-change: transform;
    padding: 40px;
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0;
}

.splash-logo-img {
    height: 280px;
    width: auto;
    display: block;
    margin: 0 auto 24px;
    filter: brightness(0) invert(1) drop-shadow(0 4px 30px rgba(0,0,0,0.3));
}

.splash-greeting {
    font-size: 2.5rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-light);
    margin-bottom: 16px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
    letter-spacing: -0.02em;
}

.splash-greeting span {
    font-weight: 700;
    color: var(--white);
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.splash-sub {
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 4px;
    text-transform: uppercase;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.splash-loader {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
    border-radius: 2px;
}

.loader-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
    animation: loadBar 2s ease-in-out forwards;
}

@keyframes loadBar {
    0% { width: 0%; }
    100% { width: 100%; }
}

/* ============================================
   ОСНОВНАЯ СТРАНИЦА
   ============================================ */
.container {
    max-width: 560px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    display: none;
}

.card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.header {
    padding: 40px 32px 28px;
    text-align: center;
    position: relative;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.header-logo {
    margin-bottom: 16px;
}

.header-logo-img {
    height: 160px;
    width: auto;
    display: block;
    margin: 0 auto;
    filter: brightness(0) invert(1) drop-shadow(0 2px 12px rgba(0,0,0,0.2));
}

.header-line {
    width: 40px;
    height: 2px;
    background: var(--gold);
    margin: 0 auto 16px;
    opacity: 0.5;
}

.header .location-tag {
    display: inline-block;
    padding: 4px 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    font-size: 0.65rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.form-container {
    padding: 28px 32px 24px;
}

/* ============================================
   ПРИВЕТСТВИЕ
   ============================================ */
.resident-greeting {
    padding: 16px 0 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    margin-bottom: 24px;
}

.greeting-text {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.greeting-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.greeting-details {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    letter-spacing: 0.3px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.greeting-divider {
    color: var(--text-dim);
    font-weight: 100;
}

/* ============================================
   ФОРМА
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.input-wrapper input {
    width: 100%;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0;
    color: var(--white);
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.input-wrapper input:focus {
    border-color: rgba(201, 168, 76, 0.4);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.1);
}

.input-wrapper input::placeholder {
    color: var(--text-dim);
    font-weight: 400;
}

.format-hint {
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-dim);
    margin-top: 4px;
    letter-spacing: 0.3px;
}

/* ============================================
   КНОПКИ ТИПОВ
   ============================================ */
.car-type-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.car-type-btn {
    flex: 1;
    min-width: 64px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-family: inherit;
    letter-spacing: 0.3px;
}

.car-type-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.car-type-btn.active {
    background: rgba(201, 168, 76, 0.15);
    border-color: rgba(201, 168, 76, 0.3);
    color: var(--gold-light);
    font-weight: 600;
}

/* ============================================
   КНОПКА ОТПРАВКИ
   ============================================ */
.submit-btn {
    width: 100%;
    padding: 16px;
    background: rgba(201, 168, 76, 0.15);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gold-light);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.submit-btn:hover:not(:disabled) {
    background: rgba(201, 168, 76, 0.25);
    border-color: rgba(201, 168, 76, 0.3);
    transform: translateY(-1px);
}

.submit-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

/* ============================================
   ИСТОРИЯ ЗАЯВОК
   ============================================ */
.history-section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.history-title {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 14px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-item {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 0;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
}

.history-item.clickable:hover {
    border-color: var(--gold);
    background: rgba(201, 168, 76, 0.05);
}

.history-item.clickable:active {
    transform: scale(0.98);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    padding-right: 10px;
}

.history-car {
    font-weight: 700;
    color: var(--white);
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.history-car-brand {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
}

.history-time {
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-dim);
}

.history-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.history-btn {
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.65rem;
    font-weight: 500;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
}

.history-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.history-btn.qr-btn {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 14px;
}

.history-btn.qr-btn:hover {
    background: rgba(59, 130, 246, 0.25);
}

.history-btn.delete-btn {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    padding: 2px 6px;
    font-size: 0.8rem;
    line-height: 1.2;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.4;
}

.history-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    opacity: 1;
}

.history-actions .status {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.55rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    white-space: nowrap;
}

.status-pending { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.status-approved { background: rgba(16, 185, 129, 0.15); color: #10b981; }
.status-on_territory { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.status-completed { background: rgba(107, 114, 128, 0.15); color: #6b7280; }
.status-rejected { background: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* ============================================
   ПОДВАЛ
   ============================================ */
.footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 20px 32px 24px;
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-dim);
    border-top: 1px solid rgba(255, 255, 255, 0.03);
    letter-spacing: 0.5px;
}

.footer span {
    color: var(--text-muted);
}

.footer .logout-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 4px 14px;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
}

.footer .logout-btn:hover {
    background: rgba(255, 0, 0, 0.08);
    border-color: rgba(255, 0, 0, 0.2);
    color: #ff6b6b;
}

.sound-toggle-btn {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    padding: 4px 14px;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.sound-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--white);
}

.sound-toggle-btn:active {
    transform: scale(0.95);
}

/* ============================================
   PWA БАННЕР
   ============================================ */
#installBanner {
    display: none;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: rgba(201, 168, 76, 0.12);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: 8px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: slideUp 0.3s ease;
}

#installBanner span {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

#installBanner #installBtn {
    padding: 6px 16px;
    background: rgba(201, 168, 76, 0.2);
    border: 1px solid rgba(201, 168, 76, 0.3);
    color: #E8D5A3;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    transition: 0.3s;
    white-space: nowrap;
}

#installBanner #installBtn:hover {
    background: rgba(201, 168, 76, 0.3);
    border-color: rgba(201, 168, 76, 0.4);
}

#installBanner #installCloseBtn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 4px;
    transition: 0.3s;
}

#installBanner #installCloseBtn:hover {
    color: var(--text-muted);
}

/* ============================================
   ГОСТЕВЫЕ КНОПКИ
   ============================================ */
.guest-type-buttons {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.guest-type-btn {
    flex: 1;
    min-width: 64px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    font-family: inherit;
    letter-spacing: 0.3px;
}

.guest-type-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
}

.guest-type-btn.active {
    background: rgba(201, 168, 76, 0.15);
    border-color: rgba(201, 168, 76, 0.3);
    color: var(--gold-light);
    font-weight: 600;
}

/* ============================================
   ПОДСКАЗКИ
   ============================================ */
.suggestions-box {
    display: none;
    position: absolute;
    background: rgba(11, 43, 74, 0.96);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    z-index: 1000;
    margin-top: 4px;
}

.suggestions-box::-webkit-scrollbar {
    width: 3px;
}

.suggestions-box::-webkit-scrollbar-track {
    background: transparent;
}

.suggestions-box::-webkit-scrollbar-thumb {
    background: rgba(201, 168, 76, 0.3);
}

.suggestion-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-light);
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(201, 168, 76, 0.06);
    color: var(--white);
}

.suggestion-icon {
    font-size: 1rem;
    opacity: 0.6;
}

/* ============================================
   УВЕДОМЛЕНИЯ
   ============================================ */
.notification {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 9998;
    max-width: 90%;
    text-align: center;
    animation: slideUp 0.3s ease;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.notification-success {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.notification-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.notification-info {
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.notification-warning {
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.notification-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    margin-left: 12px;
    opacity: 0.6;
}

.notification-close:hover {
    opacity: 1;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ============================================
   QR-МОДАЛ
   ============================================ */
#qrModal {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   RESIDENT NAME GOLD
   ============================================ */
.resident-name-gold {
    background: linear-gradient(135deg, #E8D5A3, #C9A84C, #A8893A);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.01em;
}

/* ============================================
   АДАПТИВ ДЛЯ ТЕЛЕФОНА
   ============================================ */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 24px 16px 18px;
    }

    .form-container {
        padding: 16px 16px 12px;
    }

    .greeting-name {
        font-size: 1.2rem;
    }

    .greeting-details {
        font-size: 0.65rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .greeting-divider {
        display: none;
    }

    .car-type-btn {
        font-size: 0.6rem;
        padding: 6px 8px;
        min-width: 48px;
    }

    .submit-btn {
        font-size: 0.8rem;
        padding: 12px;
    }

    .splash-greeting {
        font-size: 1.6rem;
    }

    .splash-loader {
        width: 120px;
        bottom: 50px;
    }

    .splash-logo-img {
        height: 150px;
    }

    .header-logo-img {
        height: 90px;
    }

    .footer {
        padding: 12px 16px 16px;
        gap: 6px;
        font-size: 0.5rem;
    }

    .footer .logout-btn,
    .footer .sound-toggle-btn {
        font-size: 0.55rem;
        padding: 2px 8px;
    }

    .splash-content {
        padding: 24px 16px;
        margin: 0 12px;
    }

    /* ===== ИСТОРИЯ НА ТЕЛЕФОНЕ ===== */
    .history-item {
        padding: 12px 12px 12px 14px;
        flex-wrap: wrap;
        position: relative;
    }

    .history-info {
        width: 85%;
        padding-right: 30px;
    }

    .history-car {
        font-size: 0.8rem;
    }

    .history-car-brand {
        font-size: 0.6rem;
    }

    .history-time {
        font-size: 0.5rem;
    }

    /* Кнопка удаления — правый верхний угол */
    .history-btn.delete-btn {
        position: absolute;
        top: 6px;
        right: 6px;
        font-size: 0.9rem;
        padding: 2px 6px;
        opacity: 0.5;
        background: rgba(239, 68, 68, 0.1);
        color: #ef4444;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        transition: var(--transition);
    }

    .history-btn.delete-btn:hover {
        opacity: 1;
        background: rgba(239, 68, 68, 0.2);
    }

    /* Кнопки QR и статус — внизу */
    .history-actions {
        width: 100%;
        justify-content: flex-start;
        gap: 6px;
        padding-top: 4px;
        border-top: 1px solid rgba(255, 255, 255, 0.04);
        margin-top: 4px;
    }

    .history-btn {
        font-size: 0.55rem;
        padding: 3px 10px;
    }

    .history-btn.qr-btn {
        font-size: 0.6rem;
        padding: 3px 12px;
    }

    .status {
        font-size: 0.5rem;
        padding: 2px 8px;
    }

    #installBanner {
        flex-wrap: wrap;
        padding: 8px 12px;
    }

    #installBanner span {
        font-size: 0.7rem;
        flex: 1;
    }

    #installBanner #installBtn {
        font-size: 0.65rem;
        padding: 4px 10px;
    }
}

@media (max-width: 380px) {
    .car-type-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .car-type-btn {
        font-size: 0.6rem;
        padding: 6px 4px;
    }

    .history-car {
        font-size: 0.7rem;
    }

    .history-btn {
        font-size: 0.5rem;
        padding: 2px 6px;
    }

    .history-btn.qr-btn {
        font-size: 0.55rem;
        padding: 2px 8px;
    }
}
