:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --text-dark: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --bg-light: #f9fafb;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --secondary: #6b7280;
    
    /* Тёмная тема */
    --dark-bg: #0f172a;
    --dark-surface: #1e293b;
    --dark-border: #334155;
    --dark-text: #e2e8f0;
    --dark-text-muted: #94a3b8;
}

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

html, body {
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.public-page .header.header-gradient .container {
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== ПУБЛИЧНЫЙ ИНТЕРФЕЙС - ТЁМНАЯ ТЕМА ===== */
.public-page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--dark-bg);
    color: var(--dark-text);
}

/* Белая шапка для админки */
.header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

/* Градиентная шапка для публичной страницы */
.public-page .header {
    background: none;
    border-bottom: none;
    padding: 0;
    box-shadow: none;
}

.public-page .header.header-gradient {
    background: linear-gradient(120deg, #4c1d95 0%, #7c3aed 22%, #2563eb 45%, #06b6d4 68%, #4c1d95 100%) !important;
    background-size: 300% 300% !important;
    background-position: 0% 50%;
    animation: gradient-shift 4s linear infinite !important;
    will-change: background-position;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(67, 56, 202, 0.4);
    min-height: 160px;
    display: grid;
    place-items: center;
}

.public-page .header.header-gradient > .logo-hero {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
    margin: 0;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@media (prefers-reduced-motion: reduce) {
    .public-page .header.header-gradient {
        animation: none !important;
    }
}

.logo-container-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.logo-hero {
    width: auto;
    height: auto;
    max-width: min(1200px, 90vw);
    max-height: 20vh;
    min-height: 100px;
    object-fit: contain;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.3));
}

.main-content {
    flex: 1;
    padding: 1.5rem 1rem;
}


.events-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin: 0 auto;
    max-width: 1000px;
}

.event-card {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: row;
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
    border-color: #6366f1;
}

.event-poster {
    width: 280px;
    height: 280px;
    overflow: hidden;
    background: #0f172a;
    flex-shrink: 0;
    position: relative;
}

.event-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

.event-content {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.event-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--dark-text);
}

.event-description-wrapper {
    margin-bottom: 1rem;
}

.event-description {
    color: var(--dark-text-muted);
    line-height: 1.6;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.event-description.collapsed {
    max-height: 3.2em;
    overflow: hidden;
    position: relative;
}

.event-description.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1.6em;
    background: linear-gradient(to bottom, transparent, var(--dark-surface));
}

.btn-more {
    background: none;
    border: none;
    color: #8b5cf6;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.25rem 0;
    margin-top: 0.5rem;
    text-decoration: underline;
    transition: color 0.2s;
}

.btn-more:hover {
    color: #a78bfa;
}

.event-details {
    margin: 1.25rem 0;
}

.detail-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--dark-text);
}

.detail-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.no-events {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--dark-text-muted);
}

.no-events p {
    font-size: 1.125rem;
    margin: 0.5rem 0;
}

.footer {
    background: #0a0f1f;
    border-top: 1px solid var(--dark-border);
    padding: 2rem 0;
    text-align: center;
    color: var(--dark-text-muted);
    margin-top: auto;
}

/* ===== АДМИНКА ===== */
.admin-page {
    min-height: 100vh;
    background: var(--bg-light);
}

.header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 50px;
    width: auto;
}

.site-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-dark);
}

.admin-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-nav {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.admin-nav a {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.admin-nav a:hover,
.admin-nav a.active {
    color: var(--primary-color);
    background: var(--bg-light);
}

.admin-content {
    padding: 1.5rem 1rem;
}

.admin-card {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.card-header h2 {
    margin: 0;
}

.admin-card h2 {
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.event-list-item {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.event-info h3 {
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.event-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.event-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #e5e7eb;
    color: #374151;
}

.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1.5;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-info {
    background: var(--info);
    color: white;
}

.btn-info:hover {
    background: #2563eb;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
    display: block;
}

.btn-register {
    width: 100%;
    padding: 0.875rem;
}

.public-page .btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}

.public-page .btn-primary:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #a78bfa 100%);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.table th {
    text-align: left;
    padding: 0.75rem;
    background: var(--bg-light);
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
}

.table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background: var(--bg-light);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    cursor: pointer;
}

.text-muted {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.alert {
    padding: 0.875rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.public-page .alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid #f59e0b;
}

.public-page .alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid #ef4444;
}

.public-page .alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid #10b981;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.public-page .modal-dialog {
    background: var(--dark-surface);
    color: var(--dark-text);
}

.public-page .modal-header,
.public-page .modal-footer {
    border-color: var(--dark-border);
}

.public-page .modal-header h3 {
    color: var(--dark-text);
}

.public-page .form-control {
    background: #1e293b;
    color: var(--dark-text);
    border-color: var(--dark-border);
}

.public-page .form-control:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.public-page .form-group label {
    color: var(--dark-text);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.public-page .modal-close {
    color: var(--dark-text-muted);
}

.modal-close:hover {
    background: var(--bg-light);
}

.public-page .modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
}

.login-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .event-card {
        flex-direction: column;
    }

    .event-poster {
        width: 100%;
        height: 0;
        padding-bottom: 100%;
        min-height: 0;
    }

    .event-poster img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }
    
    .event-card {
        flex-direction: column;
    }
    
    .event-poster {
        width: 100%;
        height: 0;
        padding-bottom: 100%;
    }
    
    .event-list-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .event-actions {
        width: 100%;
    }
    
    .event-actions .btn {
        flex: 1;
    }
    
    .admin-nav {
        flex-direction: column;
        align-items: stretch;
    }
    
    .admin-nav a {
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 1.25rem;
    }
    
    .logo {
        height: 40px;
    }
    
    .site-title-hero {
        font-size: 1.75rem;
    }
    
    .logo-hero {
        max-height: 15vh;
        min-height: 80px;
    }
    
    .header-gradient {
        padding: 2.5rem 1rem;
    }
}
