/* assets/css/bazzar-publisher.css */

/* === ОСНОВНОЙ КОНТЕЙНЕР === */
.bazzar-publisher-container {
    display: flex;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.bazzar-publisher-container.with-preview {
    gap: 30px;
}

/* === СЕКЦИЯ ФОРМЫ === */
.bazzar-form-section {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    overflow: hidden;
}

.form-header {
    padding: 30px;
    background: linear-gradient(135deg, #007c3e 0%, #00a050 100%);
    color: white;
}

.form-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 600;
}

/* === СЕКЦИИ ФОРМЫ === */
.form-section {
    padding: 30px;
    border-bottom: 1px solid #f0f0f0;
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    color: #333;
    font-size: 20px;
    margin: 0 0 20px 0;
    font-weight: 600;
}

.form-section h4 {
    color: #666;
    font-size: 16px;
    margin: 20px 0 15px 0;
    font-weight: 600;
}

/* === КАТЕГОРИИ === */
.category-section {
    background: #f8f9fa;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.category-item {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.category-item:hover {
    border-color: #007c3e;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,124,62,0.15);
}

.category-item.active {
    border-color: #007c3e;
    background: linear-gradient(135deg, #f0fff5 0%, #e8f5e9 100%);
}

.category-item.active::after {
    content: '✓';
    position: absolute;
    top: 8px;
    right: 8px;
    width: 22px;
    height: 22px;
    background: #007c3e;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.category-item i {
    font-size: 28px;
    color: #007c3e;
    margin-bottom: 8px;
    display: block;
}

.category-item span {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    display: block;
}

/* === ПОДКАТЕГОРИИ === */
.subcategory-section {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.subcategory-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.subcategory-item {
    padding: 10px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.subcategory-item:hover {
    border-color: #007c3e;
    background: #f0fff5;
}

.subcategory-item.active {
    background: #007c3e;
    color: white;
    border-color: #007c3e;
}

.subcategory-item span {
    font-weight: 500;
}

/* === ЗАГРУЗКА ИЗОБРАЖЕНИЙ === */
.image-upload-container {
    position: relative;
}

.image-upload-container.drag-over {
    background: #f0fff5;
    border-radius: 8px;
}

.image-upload-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 10px;
}

.image-upload-btn {
    aspect-ratio: 1;
    border: 2px dashed #d3d5d9;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: #fafafa;
    transition: all 0.2s ease;
    min-height: 120px;
}

.image-upload-btn:hover {
    border-color: #007c3e;
    background: #f0fff5;
}

.image-upload-btn i {
    font-size: 32px;
    color: #71848d;
    margin-bottom: 8px;
}

.image-upload-btn span {
    font-size: 12px;
    color: #002f34;
    font-weight: 500;
}

.uploaded-image {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #f5f5f5;
}

.uploaded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.uploaded-image.loading {
    opacity: 0.6;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f0f0f0;
    border-top-color: #007c3e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.uploaded-image .remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.7);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.uploaded-image:hover .remove-btn {
    display: flex;
}

.uploaded-image .remove-btn:hover {
    background: #ff1744;
    transform: scale(1.1);
}

.main-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: #007c3e;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

/* === ПОЛЯ ФОРМЫ === */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-size: 14px;
    font-weight: 500;
}

.required {
    color: #ff1744;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: #007c3e;
    box-shadow: 0 0 0 4px rgba(0,124,62,0.1);
}

.form-control.error {
    border-color: #ff1744;
    background: #fff5f5;
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
    font-family: inherit;
}

.char-counter {
    text-align: right;
    font-size: 12px;
    color: #999;
    margin-top: 4px;
}

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

/* === ГРУППА ЦЕНЫ === */
.price-input-group {
    display: flex;
    gap: 10px;
}

.price-input-group input {
    flex: 1;
}

.currency-select {
    width: 100px;
}

/* === ЧЕКБОКСЫ === */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin-top: 10px;
}

.checkbox-label input {
    margin-right: 8px;
}

.checkbox-label span {
    font-size: 14px;
    color: #666;
}

.checkbox-label.terms-agree {
    margin: 20px 0;
}

.checkbox-label.terms-agree span {
    color: #333;
}

.checkbox-label a {
    color: #007c3e;
    text-decoration: none;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

/* === КНОПКА ОТПРАВКИ === */
.submit-section {
    background: #f8f9fa;
    text-align: center;
}

.bazzar-submit-btn {
    background: linear-gradient(135deg, #007c3e 0%, #00a050 100%);
    color: white;
    padding: 16px 40px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(0,124,62,0.2);
}

.bazzar-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,124,62,0.3);
}

.bazzar-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.bazzar-submit-btn i {
    font-size: 20px;
}

.submit-hint {
    margin-top: 15px;
    color: #666;
    font-size: 13px;
}

/* === СЕКЦИЯ ПРЕДПРОСМОТРА === */
.bazzar-preview-section {
    width: 350px;
    position: sticky;
    top: 20px;
    height: fit-content;
}

.preview-header {
    padding: 15px 20px;
    background: #007c3e;
    color: white;
    border-radius: 12px 12px 0 0;
}

.preview-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 500;
}

.preview-content {
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    min-height: 400px;
}

.preview-empty {
    padding: 60px 20px;
    text-align: center;
    color: #999;
}

.preview-empty i {
    font-size: 48px;
    margin-bottom: 15px;
    opacity: 0.3;
}

.preview-ad {
    padding: 0;
}

.preview-images {
    height: 200px;
    background: #f5f5f5;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-images img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-images.no-image {
    color: #ccc;
}

.image-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.preview-body {
    padding: 15px;
}

.preview-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 10px 0;
}

.preview-price {
    font-size: 22px;
    font-weight: 700;
    color: #007c3e;
    margin: 0 0 10px 0;
}

.preview-price .negotiable {
    font-size: 12px;
    font-weight: normal;
    color: #666;
    margin-left: 8px;
}

.preview-meta {
    font-size: 13px;
    color: #666;
    margin: 0 0 10px 0;
}

.preview-description {
    font-size: 14px;
    color: #666;
    line-height: 1.5;
}

/* === УВЕДОМЛЕНИЯ === */
.bazzar-alert {
    position: fixed;
    top: 20px;
    right: -400px;
    max-width: 400px;
    padding: 16px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: right 0.3s ease;
    z-index: 9999;
}

.bazzar-alert.show {
    right: 20px;
}

.bazzar-alert i {
    font-size: 20px;
    flex-shrink: 0;
}

.bazzar-alert-success {
    border-left: 4px solid #4caf50;
}

.bazzar-alert-success i {
    color: #4caf50;
}

.bazzar-alert-error {
    border-left: 4px solid #ff1744;
}

.bazzar-alert-error i {
    color: #ff1744;
}

.bazzar-alert-warning {
    border-left: 4px solid #ff9800;
}

.bazzar-alert-warning i {
    color: #ff9800;
}

/* === ЭКРАН УСПЕХА === */
.success-screen {
    text-align: center;
    padding: 60px 30px;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #007c3e 0%, #00a050 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    animation: scaleIn 0.5s ease;
}

.success-icon i {
    font-size: 40px;
    color: white;
}

.success-screen h2 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 28px;
}

.success-screen p {
    color: #666;
    font-size: 16px;
    margin: 0 0 30px 0;
}

.success-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-secondary {
    padding: 12px 30px;
    background: white;
    color: #007c3e;
    border: 2px solid #007c3e;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #007c3e;
    color: white;
}

/* === СОСТОЯНИЕ ЗАГРУЗКИ === */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.no-categories {
    text-align: center;
    padding: 40px;
    color: #666;
}

/* === АВТОРИЗАЦИЯ === */
.bazzar-login-required {
    text-align: center;
    padding: 60px 30px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    max-width: 500px;
    margin: 0 auto;
}

.bazzar-login-required i {
    font-size: 48px;
    color: #999;
    margin-bottom: 20px;
}

.bazzar-login-required h3 {
    color: #333;
    margin: 0 0 10px 0;
}

.bazzar-login-required p {
    color: #666;
    margin: 0 0 30px 0;
}

/* === АНИМАЦИИ === */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* === АДАПТИВНОСТЬ === */
@media (max-width: 992px) {
    .bazzar-publisher-container {
        flex-direction: column;
    }
    
    .bazzar-preview-section {
        width: 100%;
        position: static;
        margin-top: 30px;
    }
}

@media (max-width: 768px) {
    .bazzar-publisher-container {
        padding: 10px;
    }
    
    .form-section {
        padding: 20px;
    }
    
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .image-upload-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .success-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .category-grid {
        grid-template-columns: 1fr;
    }
    
    .form-header h1 {
        font-size: 24px;
    }
    
    .image-upload-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .subcategory-item {
        padding: 8px 15px;
        font-size: 13px;
    }
}

/* === СОВМЕСТИМОСТЬ С ТЕМОЙ ADFOREST === */
.adforest-theme .bazzar-publisher-container {
    margin-top: 30px;
    margin-bottom: 30px;
}

.bazzar-publisher-container .dashicons {
    font-family: dashicons !important;
}

/* Скрытие полей до выбора категории */
#main-info-section,
#price-section,
#location-section,
#contact-section,
#submit-section,
#category-fields-section {
    display: none;
}

/* Плавное появление секций */
.form-section {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}