/* ============================================================= */
/*  AD_ADD.CSS - СТИЛИ ДЛЯ ФОРМЫ ДОБАВЛЕНИЯ ОБЪЯВЛЕНИЙ */
/* ============================================================= */

/* 1. ОБЩИЕ СТИЛИ ФОРМЫ */
.add-ad-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 30px 0;
}

.add-ad-header {
    text-align: center;
    margin-bottom: 40px;
}

.add-ad-header h1 {
    font-size: 2.5rem;
    color: #333;
    margin-bottom: 15px;
}

.add-ad-header p {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
}

.add-ad-form {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.08);
}

/* 2. ГРУППЫ ФОРМЫ И ПОЛЯ ВВОДА */
.form-group {
    margin-bottom: 30px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.form-group.active {
    opacity: 1;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-size: 1.1rem;
}

.form-control {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-control:focus {
    outline: none;
    border-color: #0088cc;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 136, 204, 0.1);
}

.form-control::placeholder {
    color: #999;
}

.form-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

/* 3. КНОПКИ */
.btn {
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
    min-width: 120px;
}

.btn-primary {
    background: #0088cc;
    color: white;
}

.btn-primary:hover {
    background: #006da3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 136, 204, 0.3);
}

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

.btn-secondary {
    background: #6c757d;
    color: white;
    border: 2px solid #6c757d;
}

.btn-secondary:hover {
    background: #5a6268;
    border-color: #5a6268;
}

.btn-outline {
    background: white;
    color: #0088cc;
    border: 2px solid #0088cc;
}

.btn-outline:hover {
    background: #f0f9ff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 136, 204, 0.1);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #eee;
    gap: 15px;
}

.form-actions .btn {
    min-width: 140px;
}

/* 4. ЗАГРУЗКА ИЗОБРАЖЕНИЙ */
.image-upload-container {
    border: 2px dashed #0088cc;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background: #f8fdff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.image-upload-container:hover {
    background: #f0f9ff;
    border-color: #006da3;
}

.image-upload-container i {
    font-size: 48px;
    color: #0088cc;
    margin-bottom: 15px;
}

.image-upload-container p {
    margin-bottom: 10px;
    color: #333;
}

.image-upload-container small {
    color: #666;
    display: block;
    margin-top: 5px;
    line-height: 1.4;
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.image-preview-item {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

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

.image-preview-item .remove-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
    color: #333;
    transition: all 0.2s ease;
}

.image-preview-item .remove-btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: scale(1.1);
}

.heic-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(0, 136, 204, 0.9);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    z-index: 2;
    pointer-events: none;
}

/* 5. СООБЩЕНИЯ ОБ ОШИБКАХ И УСПЕХЕ */
.error-message {
    color: #dc3545;
    font-size: 0.9rem;
    margin-top: 5px;
    display: none;
}

.error-message.show {
    display: block;
}

.success-message {
    color: #28a745;
    font-size: 0.9rem;
    margin-top: 5px;
    display: none;
}

.success-message.show {
    display: block;
}

/* 6. ПРОГРЕСС-БАР */
.form-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    position: relative;
}

.form-progress:before {
    content: '';
    position: absolute;
    top: 15px;
    left: 10%;
    right: 10%;
    height: 3px;
    background: #e0e0e0;
    z-index: 1;
}

.progress-step {
    position: relative;
    z-index: 2;
    text-align: center;
    width: 25%;
}

.progress-step .step-number {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e0e0e0;
    color: #666;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.progress-step.active .step-number {
    background: #0088cc;
    color: white;
}

.progress-step.completed .step-number {
    background: #28a745;
    color: white;
}

.progress-step .step-label {
    font-size: 0.9rem;
    color: #666;
}

.progress-step.active .step-label {
    color: #0088cc;
    font-weight: 600;
}

.progress-step.completed .step-label {
    color: #28a745;
}

/* 7. АВТОКОМПЛИТ ГОРОДОВ */
.city-autocomplete {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    max-height: 250px;
    overflow-y: auto;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    margin-top: 5px;
    width: 100%;
    display: none;
}

.autocomplete-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #333;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
    background: #f0f9ff;
    color: #0088cc;
}

.autocomplete-item:hover {
    transform: translateX(2px);
}

/* 8. СТРАНИЦА РЕЗУЛЬТАТА */
.result-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 60px 20px;
    text-align: center;
}

.result-icon {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    font-size: 48px;
}

.success .result-icon {
    background: #d4edda;
    color: #28a745;
    border: 5px solid #c3e6cb;
}

.error .result-icon {
    background: #f8d7da;
    color: #dc3545;
    border: 5px solid #f5c6cb;
}

.result-title {
    font-size: 2.5rem;
    margin-bottom: 20px;
    color: #333;
}

.result-message {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
    flex-wrap: wrap;
}

.result-actions .btn {
    flex: 1;
    min-width: 180px;
    max-width: 250px;
}

.ad-link {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 30px 0;
    border-left: 4px solid #0088cc;
    text-align: left;
}

.ad-link h3 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.2rem;
}

.ad-link a {
    color: #0088cc;
    word-break: break-all;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.5;
}

.ad-link a:hover {
    text-decoration: underline;
}

/* 9. АДАПТИВНОСТЬ */
/* Планшеты и маленькие десктопы */
@media (max-width: 992px) {
    .add-ad-form {
        padding: 30px 25px;
    }
    
    .result-actions {
        gap: 12px;
    }
    
    .result-actions .btn {
        min-width: 160px;
        max-width: 220px;
    }
}

/* Мобильные устройства */
@media (max-width: 768px) {
    .add-ad-container {
        padding: 20px 15px;
    }
    
    .add-ad-form {
        padding: 25px 20px;
    }
    
    .add-ad-header h1 {
        font-size: 2rem;
    }
    
    .form-progress {
        display: none; /* На мобильных скрываем прогресс-бар */
    }
    
    .form-actions {
        flex-direction: column;
        gap: 12px;
    }
    
    .form-actions .btn {
        width: 100%;
        min-width: auto;
        max-width: 100%;
    }
    
    .image-upload-container {
        padding: 25px 15px;
    }
    
    .image-upload-container i {
        font-size: 36px;
    }
    
    .image-preview-item {
        width: 80px;
        height: 80px;
    }
    
    /* Автокомплит городов */
    .city-autocomplete {
        max-height: 200px;
    }
    
    .autocomplete-item {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    /* Страница результата */
    .result-container {
        padding: 40px 15px;
    }
    
    .result-icon {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }
    
    .result-title {
        font-size: 2rem;
    }
    
    .result-message {
        font-size: 1.1rem;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .result-actions .btn {
        width: 100%;
        max-width: 100%;
        min-width: auto;
    }
    
    .ad-link {
        padding: 15px;
    }
    
    .ad-link h3 {
        font-size: 1.1rem;
    }
    
    .ad-link a {
        font-size: 0.9rem;
    }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
    .add-ad-header h1 {
        font-size: 1.8rem;
    }
    
    .add-ad-header p {
        font-size: 1rem;
    }
    
    .form-group label {
        font-size: 1rem;
    }
    
    .form-control {
        padding: 12px;
        font-size: 0.95rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }
    
    .image-preview-item {
        width: 70px;
        height: 70px;
    }
    
    .result-title {
        font-size: 1.8rem;
    }
    
    .result-message {
        font-size: 1rem;
    }
}

/* Для очень маленьких экранов с высотой экрана меньше 600px */
@media (max-height: 600px) and (max-width: 768px) {
    .add-ad-container {
        padding: 15px 10px;
    }
    
    .add-ad-header {
        margin-bottom: 25px;
    }
    
    .add-ad-header h1 {
        font-size: 1.6rem;
        margin-bottom: 10px;
    }
    
    .form-group {
        margin-bottom: 20px;
    }
}