* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
}

nav {
    display: flex;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: #666;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
}

.nav-link:hover {
    background: #f0f0f0;
    color: #333;
}

.nav-link.active {
    background: #007bff;
    color: white;
}

#selected-count {
    display: inline-block;
    background: #ff4757;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 5px;
}

/* Filters */
.filters {
    background: white;
    padding: 20px 0;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
    color: #555;
}

.range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-inputs input {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    width: 100%; /* Одинаковая ширина */
}

/* Убираем стрелки у number input */
.range-inputs input[type="number"]::-webkit-inner-spin-button,
.range-inputs input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.range-inputs input[type="number"] {
    -moz-appearance: textfield;
}

.range-inputs span {
    color: #999;
    flex-shrink: 0;
}

.filter-group select,
.filter-group input[type="text"] {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}


/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

#apply-filters,
#reset-filters {
    margin-right: 10px;
}

/* Models Grid */
.models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.model-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
}

.model-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.model-card-image {
    width: 100%;
    height: 350px;
    object-fit: cover;
    background: #f0f0f0;
}

.model-card-info {
    padding: 15px;
}

.model-card-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.model-card-details {
    font-size: 14px;
    color: #666;
}

.like-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: none;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s;
}

.like-btn:hover {
    transform: scale(1.1);
}

.like-btn.liked {
    color: #ff4757;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    position: relative;
}

.modal-content.large {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-bottom: 20px;
}

.modal-content input[type="text"],
.modal-content input[type="password"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
}

.close:hover {
    color: #333;
}

.url-box {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.url-box input {
    flex: 1;
}

/* Model Details */
.model-details-header {
    margin-bottom: 20px;
}

.model-details-header h2 {
    font-size: 24px;
    margin-bottom: 10px;
}

.model-details-info {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.model-info-item {
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.model-info-item strong {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

/* Masonry layout для фотографий как в Pinterest */
.model-photos {
    column-count: 3;
    column-gap: 10px;
    margin-top: 20px;
}

.model-photo {
    width: 100%;
    height: auto;
    margin-bottom: 10px;
    border-radius: 8px;
    break-inside: avoid;
    display: block;
}

@media (max-width: 768px) {
    .model-photos {
        column-count: 2;
    }
}

@media (max-width: 480px) {
    .model-photos {
        column-count: 1;
    }
}


/* Admin Panel */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0;
}

.admin-nav {
    margin-bottom: 20px;
}

.admin-nav-btn {
    padding: 10px 20px;
    background: #e9ecef;
    border: none;
    cursor: pointer;
    font-weight: 500;
    margin-right: 10px;
    border-radius: 6px;
}

.admin-nav-btn.active {
    background: #007bff;
    color: white;
}

.selections-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.selections-table table {
    width: 100%;
    border-collapse: collapse;
}

.selections-table th,
.selections-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.selections-table th {
    background: #f8f9fa;
    font-weight: 600;
}

.selections-table tr:hover {
    background: #f8f9fa;
    cursor: pointer;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Responsive */
@media (max-width: 768px) {
    header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    nav {
        flex-wrap: wrap;
    }
    
    .filters-grid {
        grid-template-columns: 1fr;
    }
    
    .models-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .model-card-image {
        height: 250px;
    }
}
