* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #0a0a0f;
    color: #eef2ff;
    transition: background 0.25s ease;
}

body.light {
    background: #f5f7fb;
    color: #1a1e2c;
}

/* ==================== ШАПКА ==================== */
.header {
    padding: 18px 20px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 100;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(85,82,232,0.2);
}

.logo {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #c0b9ff, #7c76ff);
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    cursor: pointer;
    text-decoration: none;
}

.logo i {
    color: #7c76ff;
    background: none;
    -webkit-background-clip: unset;
}

/* ==================== КНОПКИ ==================== */
.btn {
    background: rgba(85,82,232,0.2);
    border: 1px solid rgba(85,82,232,0.5);
    border-radius: 40px;
    padding: 8px 16px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-family: inherit;
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    background: rgba(85,82,232,0.3);
}

.btn-primary {
    background: #5552E8;
    border-color: #5552E8;
    color: white;
}

.btn-primary:hover {
    background: #6c68ff;
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(220, 38, 38, 0.9);
    border-color: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* ==================== КАРТОЧКИ ==================== */
.card {
    background: #111217;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid #232433;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s;
}

body.light .card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

.card-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    background-size: cover;
    background-position: center;
    position: relative;
    background-color: #2a2c3e;
}

/* ==================== СТАТУСЫ ==================== */
.status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: 700;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 2;
}

.status-free {
    background: #5552E8;
    color: white;
}

.status-occupied {
    background: #8a571d;
    color: white;
}

.status-soon {
    background: #e9b35f;
    color: #1e1a2f;
}

.status-badge-small {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 40px;
    font-size: 0.7rem;
    font-weight: 600;
}

/* ==================== КАРТОЧКА ИНФО ==================== */
.card-info {
    padding: 16px;
}

.price {
    font-size: 1.3rem;
    font-weight: 800;
}

.address {
    font-size: 0.75rem;
    opacity: 0.7;
    margin: 5px 0;
    word-break: break-word;
}

.details {
    display: flex;
    gap: 12px;
    font-size: 0.7rem;
    margin-top: 8px;
    flex-wrap: wrap;
}

.description-preview {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 8px;
    line-height: 1.4;
}

/* ==================== МОДАЛЬНОЕ ОКНО ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #111217;
    border-radius: 32px;
    max-width: 550px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    position: relative;
}

body.light .modal-content {
    background: #ffffff;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
}

/* ==================== ФОРМЫ ==================== */
.form-group {
    margin-bottom: 20px;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border-radius: 20px;
    border: 1px solid #2c2e3e;
    background: #1a1b26;
    color: white;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #5552E8;
    box-shadow: 0 0 0 3px rgba(85, 82, 232, 0.2);
}

body.light input,
body.light select,
body.light textarea {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1a1e2c;
}

body.light input:focus,
body.light select:focus,
body.light textarea:focus {
    border-color: #5552E8;
    box-shadow: 0 0 0 3px rgba(85, 82, 232, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 6px;
}

.submit-btn {
    background: #5552E8;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 40px;
    font-weight: 700;
    width: 100%;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    margin-top: 16px;
    transition: transform 0.2s, background 0.2s;
}

.submit-btn:hover {
    background: #6c68ff;
    transform: translateY(-2px);
}

.submit-btn:disabled {
    opacity: 0.7;
    transform: none;
    cursor: not-allowed;
}

/* ==================== ГАЛЕРЕЯ ФОТО ==================== */
.photos-gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.photo-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: border 0.2s;
}

.photo-item.main {
    border-color: #5552E8;
}

.photo-item .main-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    background: gold;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: #1a1e2c;
}

.photo-item .remove-photo {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.7rem;
    transition: background 0.2s;
}

.photo-item .remove-photo:hover {
    background: #dc2626;
}

.upload-photo-btn {
    background: rgba(85, 82, 232, 0.1);
    border: 2px dashed #5552E8;
    padding: 14px;
    border-radius: 20px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}

.upload-photo-btn:hover {
    background: rgba(85, 82, 232, 0.2);
}

/* ==================== КАРТА ==================== */
.map-section {
    margin: 16px;
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

#map {
    height: 280px;
    width: 100%;
    background: #1e1f2c;
}

.custom-marker {
    background: transparent !important;
    border: none !important;
}

.leaflet-control-attribution,
.leaflet-control-zoom {
    display: none !important;
}

/* ==================== ФИЛЬТРЫ ==================== */
.filters {
    padding: 8px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-chip {
    background: #1e1f2c;
    padding: 6px 16px;
    border-radius: 40px;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid #2c2e3e;
    transition: all 0.2s;
}

.filter-chip.active {
    background: #5552E8;
    color: white;
    border-color: #5552E8;
}

.filter-chip:hover {
    background: rgba(85, 82, 232, 0.3);
}

body.light .filter-chip {
    background: #edf2f7;
    color: #1e293b;
    border-color: #e2e8f0;
}

body.light .filter-chip.active {
    background: #5552E8;
    color: white;
}

/* ==================== КОНТАКТЫ И СОЦСЕТИ ==================== */
.contact-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
    justify-content: center;
}

.contact-icon {
    width: 56px;
    height: 56px;
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.contact-icon:hover {
    transform: scale(1.05);
}

.contact-icon.phone {
    background: #5552E8;
}

.contact-icon.whatsapp {
    background: #25D366;
}

.contact-icon.telegram {
    background: #26A5E4;
}

.contact-icon.vk {
    background: #0077FF;
}

.contact-icon.viber {
    background: #7360F2;
}

/* Светлая тема для контактов - все иконки в фирменном фиолетовом */
body.light .contact-icon {
    background: #5552E8 !important;
    color: white !important;
}

body.light .contact-icon i {
    color: white !important;
}

body.light .contact-icon:hover {
    background: #6c68ff !important;
    transform: scale(1.05);
}

/* ==================== ТАБЛИЦЫ (АДМИН-ПАНЕЛЬ) ==================== */
.table-container {
    overflow-x: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #111217;
    border-radius: 16px;
    overflow: hidden;
}

body.light table {
    background: white;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #2c2e3e;
}

body.light th,
body.light td {
    border-bottom-color: #e2e8f0;
}

th {
    background: rgba(85, 82, 232, 0.2);
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 8px;
}

.action-btn {
    padding: 4px 10px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    font-size: 0.75rem;
    transition: opacity 0.2s;
}

.action-btn:hover {
    opacity: 0.8;
}

.edit-btn {
    background: #5552E8;
    color: white;
}

.delete-btn {
    background: #dc2626;
    color: white;
}

.thumbnail {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
}

/* ==================== СТАТИСТИКА (АДМИН) ==================== */
.stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin: 16px;
}

.stat-card {
    background: rgba(85, 82, 232, 0.1);
    border-radius: 20px;
    padding: 12px 20px;
    text-align: center;
    min-width: 100px;
    flex: 1;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: #5552E8;
}

.stat-label {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* ==================== СТУДИЯ ==================== */
.studio-badge {
    background: linear-gradient(135deg, #9b59b6, #5552E8);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-block;
}

.rooms-type-selector {
    display: flex;
    gap: 20px;
    align-items: center;
    background: rgba(85, 82, 232, 0.1);
    padding: 12px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.rooms-type-selector label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    margin-bottom: 0;
    font-weight: normal;
}

.rooms-type-selector input[type="radio"] {
    width: auto;
    margin: 0;
    accent-color: #5552E8;
}

.studio-badge-preview {
    background: linear-gradient(135deg, #9b59b6, #5552E8);
    padding: 8px 16px;
    border-radius: 20px;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ==================== ЛАЙТБОКС ==================== */
.lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

.lightbox.active {
    display: flex;
}

.lightbox-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 3rem;
    cursor: pointer;
    color: white;
    z-index: 2001;
}

/* ==================== ЗАГРУЗЧИК ==================== */
.loader {
    text-align: center;
    padding: 40px;
    color: #8e8ea8;
}

.empty-state {
    text-align: center;
    padding: 40px;
    opacity: 0.7;
}

/* ==================== ФУТЕР ==================== */
footer {
    text-align: center;
    font-size: 0.7rem;
    padding: 20px;
    opacity: 0.6;
}

/* ==================== АДАПТИВНОСТЬ ==================== */
@media (max-width: 768px) {
    /* Шапка */
    .header {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px;
    }
    
    .logo {
        text-align: center;
        font-size: 1.2rem;
    }
    
    /* Формы */
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .rooms-type-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .coord-row {
        grid-template-columns: 1fr;
    }
    
    /* Карточки */
    .card-info {
        padding: 12px;
    }
    
    .price {
        font-size: 1.1rem;
    }
    
    .details {
        gap: 8px;
    }
    
    /* Таблица админки */
    .table-container {
        padding: 8px;
    }
    
    th,
    td {
        padding: 8px;
        font-size: 0.75rem;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }
    
    .action-btn {
        padding: 4px 8px;
        font-size: 0.7rem;
    }
    
    .thumbnail {
        width: 40px;
        height: 40px;
    }
    
    /* Статистика */
    .stats {
        gap: 8px;
        margin: 12px;
    }
    
    .stat-card {
        padding: 8px 12px;
        min-width: 70px;
    }
    
    .stat-number {
        font-size: 1.2rem;
    }
    
    .stat-label {
        font-size: 0.6rem;
    }
    
    /* Контакты */
    .contact-buttons {
        gap: 8px;
    }
    
    .contact-icon {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }
    
    /* Фильтры */
    .filters {
        padding: 8px 12px;
        gap: 8px;
    }
    
    .filter-chip {
        padding: 4px 12px;
        font-size: 0.7rem;
    }
    
    /* Карта */
    .map-section {
        margin: 12px;
    }
    
    #map {
        height: 220px;
    }
    
    /* Фото галерея */
    .photo-item {
        width: 70px;
        height: 70px;
    }
    
    .photo-thumbs {
        gap: 6px;
        padding: 8px;
    }
    
    .thumb {
        width: 55px;
        height: 55px;
    }
}

/* Для очень маленьких экранов (до 480px) */
@media (max-width: 480px) {
    .stats {
        flex-wrap: wrap;
    }
    
    .stat-card {
        min-width: calc(50% - 8px);
    }
    
    .photo-item {
        width: 60px;
        height: 60px;
    }
    
    .thumb {
        width: 50px;
        height: 50px;
    }
    
    .price-large {
        font-size: 1.2rem;
    }
    
    .info-row {
        flex-direction: column;
        gap: 4px;
    }
    
    .info-row span:first-child {
        font-size: 0.7rem;
        opacity: 0.7;
    }
}

/* ==================== КАСТОМНЫЕ ЭЛЕМЕНТЫ ==================== */
/* Скроллбар для Webkit */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(85, 82, 232, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #5552E8;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #6c68ff;
}

/* Выделение текста */
::selection {
    background: #5552E8;
    color: white;
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card,
.modal-content {
    animation: fadeIn 0.3s ease;
}

/* Ссылки */
a {
    text-decoration: none;
    color: inherit;
}

/* Кнопка "Загрузить еще" */
.load-more-btn {
    background: rgba(85, 82, 232, 0.2);
    border: 1px solid #5552E8;
    padding: 14px;
    border-radius: 40px;
    text-align: center;
    cursor: pointer;
    margin-top: 8px;
    font-weight: 600;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: #5552E8;
    color: white;
}

/* Разделитель */
hr {
    border: none;
    border-top: 1px solid rgba(85, 82, 232, 0.3);
    margin: 20px 0;
}