/* ═══════════════════════════════════════
   БАЗОВЫЕ СТИЛИ И ПЕРЕМЕННЫЕ
═══════════════════════════════════════ */
:root {
    --color-bg-dark: #0f1123;
    --color-accent: #e94560;
    --color-accent-hover: #ff5c7a;
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-bg-strong: rgba(255, 255, 255, 0.14);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-blur: 14px;
    --text-light: #fff;
    --text-muted: rgba(255, 255, 255, 0.75);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
}

/* main должен растягиваться и занимать всё свободное пространство,
   выталкивая футер вниз независимо от количества контента */
main {
    flex: 1 0 auto;
    padding: 0 24px;
}

.site-footer {
    flex-shrink: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    color: #1a1a2e;
    line-height: 1.6;
    background: #f5f6fa;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: #fff;
    padding: 8px 16px;
    z-index: 200;
}
.skip-link:focus { left: 0; }

/* ═══════════════════════════════════════
   ШАПКА — стеклянная, прилипающая сверху
   (Apple использует именно этот паттерн для nav bar) [web:170]
═══════════════════════════════════════ */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(15, 17, 35, 0.55);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
    padding: 14px 24px;
}

.site-header nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 12px;
    /* Убрали max-width и margin: 0 auto — теперь nav растягивается на всю ширину
       .site-header, а не центрируется отдельным блоком внутри него */
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-light);
    text-decoration: none;
    letter-spacing: -0.5px;
}
.nav-links {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.nav-links a {
    text-decoration: none;
    color: var(--text-light);
    font-size: 0.95rem;
    padding: 8px 4px;
}
.nav-links .btn-outline {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 8px 18px;
}

/* ═══════════════════════════════════════
   DASHBOARD 
═══════════════════════════════════════ */
.dashboard-page {
    max-width: 900px;
    margin: 40px auto;
}
.dashboard-page h1 { margin-bottom: 24px; }
.dashboard-page h2 { margin: 32px 0 16px; }

.dashboard-alert {
    background: #fff3cd;
    color: #856404;
    padding: 14px 18px;
    border-radius: 12px;
    margin-bottom: 20px;
}
.dashboard-alert a { color: #856404; font-weight: 700; text-decoration: underline; }
.dashboard-alert-success {
    background: #d4edda;
    color: #155724;
}

.dashboard-info-card {
    background: rgba(26, 26, 46, 0.04);
    border: 1px solid rgba(26, 26, 46, 0.08);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bids-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}
.bids-table th, .bids-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid rgba(26, 26, 46, 0.08);
}
.bids-table th { font-size: 0.85rem; color: #666; text-transform: uppercase; }

.badge-leading {
    background: #d4edda;
    color: #155724;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}
.badge-outbid {
    background: #f8d7da;
    color: #721c24;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

@media (max-width: 600px) {
    .dashboard-page { margin: 20px 16px; }
    .bids-table { font-size: 0.85rem; }
    .bids-table th, .bids-table td { padding: 8px 6px; }
}

/* ═══════════════════════════════════════
   HERO — градиент + стеклянные CTA-кнопки
═══════════════════════════════════════ */
.hero {
    background:
        radial-gradient(circle at 20% 20%, rgba(233, 69, 96, 0.35), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(88, 101, 242, 0.35), transparent 50%),
        linear-gradient(135deg, #1a1a2e, #16213e);
    color: var(--text-light);
    padding: 64px 20px;
    text-align: center;
}
.hero-content { max-width: 720px; margin: 0 auto; }
.hero h1 {
    font-size: clamp(1.75rem, 5vw, 2.75rem);
    margin-bottom: 16px;
    font-weight: 800;
    letter-spacing: -0.5px;
}
.hero-subtitle {
    font-size: clamp(1rem, 2.5vw, 1.15rem);
    color: var(--text-muted);
    margin-bottom: 32px;
}
.hero-cta {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
    padding: 14px 32px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    border: none;
    box-shadow: 0 8px 24px rgba(233, 69, 96, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.btn-primary:hover, .btn-primary:active {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(233, 69, 96, 0.5);
}

/* Стеклянная вторичная кнопка — классический glassmorphism [web:166][web:167] */
.btn-secondary, .btn-outline {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    border: 1px solid var(--glass-border);
    color: var(--text-light);
    padding: 13px 30px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    transition: background 0.2s ease;
}
.btn-secondary:hover, .btn-outline:hover {
    background: var(--glass-bg-strong);
}

/* ═══════════════════════════════════════
   СЕКЦИИ СО СВЕТЛЫМ ФОНОМ
═══════════════════════════════════════ */
.how-it-works, .upcoming-auctions, .trust-block {
    max-width: 1100px;
    margin: 0 auto;
    padding: 48px 20px;
}
.how-it-works h2, .upcoming-auctions h2, .trust-block h2, .final-cta h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    text-align: center;
    margin-bottom: 32px;
}

.steps-grid, .auctions-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

/* Стеклянные карточки на светлом фоне — используем тёмное стекло вместо белого,
   так как на светлом фоне белое стекло практически не создаёт контраста [web:169] */
.step-card, .auction-preview-card {
    background: rgba(26, 26, 46, 0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(26, 26, 46, 0.08);
    border-radius: 16px;
    padding: 28px 20px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.step-card:hover, .auction-preview-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(26, 26, 46, 0.1);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--color-accent);
    color: #fff;
    border-radius: 50%;
    margin-bottom: 14px;
    font-weight: 700;
}

.status-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 10px;
}
.status-active { background: #d4edda; color: #155724; }
.status-upcoming { background: #fff3cd; color: #856404; }
.status-finished { background: #e2e3e5; color: #383d41; }

.view-all-link { display: block; text-align: center; margin-top: 28px; }

/* ═══════════════════════════════════════
   БЛОК ДОВЕРИЯ
═══════════════════════════════════════ */
.trust-list { list-style: none; max-width: 700px; margin: 0 auto; }
.trust-list li {
    padding: 14px 0 14px 36px;
    position: relative;
    border-bottom: 1px solid #eee;
}
.trust-list li:last-child { border-bottom: none; }
.trust-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    top: 12px;
    color: #28a745;
    font-weight: bold;
    font-size: 1.1rem;
}

/* ═══════════════════════════════════════
   ФИНАЛЬНЫЙ CTA — стеклянный блок на тёмном градиенте
═══════════════════════════════════════ */
.final-cta {
    text-align: center;
    padding: 56px 20px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: var(--text-light);
}
.final-cta h2 { color: var(--text-light); }

/* ═══════════════════════════════════════
   ФУТЕР
═══════════════════════════════════════ */
.site-footer {
    text-align: center;
    padding: 28px 20px;
    background: #0f1123;
    color: var(--text-muted);
}
.site-footer nav { margin-top: 10px; }
.site-footer a {
    color: var(--text-muted);
    margin: 0 10px;
    text-decoration: none;
    font-size: 0.9rem;
}
.site-footer a:hover { color: #fff; }

/* ═══════════════════════════════════════
   СТЕКЛЯННЫЕ ФОРМЫ (логин/регистрация/ставки)
   Переиспользуются на страницах auth и аукциона
═══════════════════════════════════════ */
.auth-page {
    max-width: 420px;
    margin: 60px auto;
    padding: 32px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.auth-form label { font-weight: 600; font-size: 0.9rem; }
.auth-form input {
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
}
.auth-form input:focus { outline: 2px solid var(--color-accent); border-color: transparent; }

/* ═══════════════════════════════════════
   СТРАНИЦА АУКЦИОНА (show.php)
═══════════════════════════════════════ */
.auction-show-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 32px 24px;
}
.auction-show-page h1 {
    margin-bottom: 12px;
}

/* Галерея фото лота — сетка вместо растянутых во всю ширину картинок */
.lot-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin: 24px 0;
}
.lot-photos img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.08);
}

/* Если фото одно — не растягиваем на всю ширину блока */
.lot-photos:has(img:only-child) {
    grid-template-columns: minmax(200px, 400px);
}

.lot-description {
    margin: 20px 0;
    line-height: 1.7;
    color: #444;
}

/* Прогресс-бар таймера раунда */
.timer-progress {
    width: 100%;
    height: 8px;
    background: rgba(233, 69, 96, 0.15);
    border-radius: 20px;
    overflow: hidden;
    margin-top: 4px;
}
.timer-progress-bar {
    height: 100%;
    background: var(--color-accent);
    border-radius: 20px;
    transition: width 1s linear;
}

.bid-status-note {
    text-align: center;
    color: #856404;
    background: #fff3cd;
    padding: 10px 14px;
    border-radius: 10px;
    margin-top: 16px;
    font-size: 0.9rem;
}

/* История ставок */
.bid-history-section {
    margin-top: 40px;
}
.bid-history-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.06);
    margin-top: 16px;
}
.bid-history-table th, .bid-history-table td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(26, 26, 46, 0.08);
}
.bid-history-table th {
    background: rgba(26, 26, 46, 0.04);
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
}
.bid-history-table tr:last-child td { border-bottom: none; }
.bid-history-table tr:first-child td {
    font-weight: 700;
    color: var(--color-accent);
}

/* Скрываем плеер/видео-элемент звукового оповещения — он не должен быть виден визуально */
audio, video.notification-sound {
    display: none;
}

@media (max-width: 600px) {
    .auction-show-page { padding: 20px 16px; }
    .lot-photos { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .lot-photos img { height: 140px; }
    .bid-history-table { display: block; overflow-x: auto; white-space: nowrap; }
}

.auctions-filter {
    display: flex;
    gap: 16px;
    margin: 20px 0 32px;
    flex-wrap: wrap;
}
.auctions-filter a {
    text-decoration: none;
    color: #1a1a2e;
    padding: 8px 18px;
    border-radius: 10px;
    background: rgba(26, 26, 46, 0.06);
    font-weight: 600;
    font-size: 0.9rem;
}
.auctions-filter a:hover { background: rgba(26, 26, 46, 0.12); }

.bid-panel {
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    padding: 24px;
    margin: 24px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}
.price-block, .timer-block, .leader-block {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
.bid-error {
    background: #fdecea;
    color: #c0392b;
    padding: 10px 14px;
    border-radius: 10px;
    margin: 12px 0;
    font-size: 0.9rem;
}
.bid-form { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.bid-form input { flex: 1; min-width: 140px; padding: 12px; border-radius: 10px; border: 1px solid #ddd; }


/* ═══════════════════════════════════════
   FALLBACK — если backdrop-filter не поддерживается браузером
   (обязательное правило для деградации без потери читаемости) [web:174]
═══════════════════════════════════════ */
@supports not (backdrop-filter: blur(1px)) {
    .site-header { background: rgba(15, 17, 35, 0.92); }
    .btn-secondary, .btn-outline, .nav-links .btn-outline { background: rgba(255, 255, 255, 0.25); }
    .step-card, .auction-preview-card { background: rgba(255, 255, 255, 0.95); }
    .auth-page, .bid-panel { background: rgba(255, 255, 255, 0.96); }
}
/* ═══════════════════════════════════════
   АДМИН-ПАНЕЛЬ — список лотов, формы, заявки
═══════════════════════════════════════ */
.existing-photos {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: -8px;
}
.existing-photos img {
    border-radius: 8px;
    object-fit: cover;
    height: 100px;
    width: 100px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500 !important;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}
.admin-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.btn-secondary-admin {
    display: inline-block;
    background: #fff;
    color: var(--color-accent);
    border: 2px solid var(--color-accent);
    padding: 12px 30px;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
}
.btn-secondary-admin:hover { background: rgba(233, 69, 96, 0.06); }

.admin-lots-page, .admin-form-page, .admin-requests-page {
    max-width: 1100px;
    margin: 40px auto;
}
.admin-lots-page h1 { margin-bottom: 20px; }

.admin-lots-page .btn-primary {
    display: inline-block;
    margin-bottom: 28px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.06);
}
.admin-table th, .admin-table td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(26, 26, 46, 0.08);
}
.admin-table th {
    background: rgba(26, 26, 46, 0.04);
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
    font-weight: 700;
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table img { border-radius: 8px; display: block; }

.admin-table a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
    margin-right: 12px;
}
.admin-table a:hover { text-decoration: underline; }

.inline-form { display: inline-block; }
.btn-danger {
    background: #dc3545;
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.85rem;
}
.btn-danger:hover { background: #c82333; }

/* Формы админки — создание/редактирование лота и аукциона */
.admin-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 600px;
    background: #fff;
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.06);
    margin-top: 20px;
}
.admin-form label { font-weight: 600; font-size: 0.9rem; }
.admin-form input,
.admin-form select,
.admin-form textarea {
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
}
.admin-form textarea { min-height: 120px; resize: vertical; }
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
    outline: 2px solid var(--color-accent);
    border-color: transparent;
}
.admin-form button {
    align-self: flex-start;
    border: none;
    cursor: pointer;
}

/* Таблица заявок на модерации */
.requests-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.06);
}
.requests-table th, .requests-table td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(26, 26, 46, 0.08);
}
.requests-table th {
    background: rgba(26, 26, 46, 0.04);
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #666;
}
.requests-table .inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.requests-table .inline-form input[type="text"] {
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    min-width: 140px;
}
.requests-table button {
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
}
.requests-table button[value="approved"] { background: #28a745; color: #fff; }
.requests-table button[value="rejected"] { background: #dc3545; color: #fff; }

/* Мобильная адаптация админки — таблицы со скроллом вместо переполнения */
@media (max-width: 768px) {
    .admin-lots-page, .admin-form-page, .admin-requests-page {
        margin: 24px 16px;
    }
    .admin-table, .requests-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    .admin-form { padding: 20px; }
}
/* ═══════════════════════════════════════
   MOBILE-FIRST АДАПТАЦИЯ
   Базовые стили выше уже написаны с учётом мобильных (flex-wrap, clamp, grid auto-fit).
   Ниже — точечные корректировки для очень маленьких экранов.
═══════════════════════════════════════ */
@media (max-width: 600px) {
    .site-header nav { flex-direction: column; align-items: flex-start; }
    .nav-links { width: 100%; justify-content: space-between; }

    .hero { padding: 48px 16px; }
    .hero-cta { flex-direction: column; align-items: stretch; }
    .btn-primary, .btn-secondary, .btn-outline { text-align: center; width: 100%; }

    .steps-grid, .auctions-preview-grid { grid-template-columns: 1fr; }

    .auth-page { margin: 24px 16px; padding: 24px; }
    .bid-panel { padding: 18px; }
    .bid-form { flex-direction: column; }
    .bid-form input, .bid-form button { width: 100%; }

    .site-footer nav { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
}

/* Уменьшаем blur на маленьких экранах — экономия батареи и GPU на слабых мобильных [web:169][web:170] */
@media (max-width: 480px) {
    :root { --glass-blur: 8px; }
}