/* 
   car-admin.css - Tyson Autogarage
   CSS per la gestione amministrativa delle auto
*/

/* ===== VARIABILI ===== */
:root {
    --primary-color: #1a1a1a;
    --secondary-color: #cd2122;
    --text-color: #333333;
    --bg-color: #f8f9fa;
    --light-gray: #f8f9fa;
    --medium-gray: #e9ecef;
    --dark-gray: #6c757d;
    --box-shadow: 0 3px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

/* ===== CONTAINER ADMIN ===== */
.admin-container {
    padding: 2rem 0;
    background-color: var(--bg-color);
    min-height: calc(100vh - 200px);
}

.admin-container .content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ===== HEADER ADMIN ===== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eaecef;
}

.admin-title {
    margin: 0;
    color: var(--text-color);
    font-size: 2rem;
    font-weight: 700;
    position: relative;
}

.admin-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--secondary-color);
}

.back-button, .add-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.add-button {
    background-color: var(--secondary-color);
    color: white;
}

.add-button:hover {
    background-color: #b01d1d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.back-button {
    background-color: var(--light-gray);
    color: var(--text-color);
    border: 1px solid #eaecef;
}

.back-button:hover {
    background-color: #eaecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.add-button i, .back-button i {
    font-size: 1rem;
}

/* ===== MESSAGGI DI AVVISO ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.alert.success {
    background-color: #e6f7e8;
    color: #1e7e34;
    border-left: 4px solid #28a745;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

.alert ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

/* ===== GRIGLIA AUTO ===== */
.cars-grid.admin-cars {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.car-item {
    display: flex;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
    position: relative;
}

.car-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.car-image {
    width: 120px;
    height: 140px;
    overflow: hidden;
    position: relative;
}

.car-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.car-item:hover .car-image img {
    transform: scale(1.1);
}

.car-image .no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    width: 100%;
    background-color: #f5f5f5;
    color: #aaa;
    font-size: 0.8rem;
    text-align: center;
    padding: 0.5rem;
}

.car-image .no-image i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #ddd;
}

.car-info {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.car-info h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    line-height: 1.3;
}

.car-details {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: auto;
}

.car-price {
    font-weight: 700;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.car-mileage {
    color: var(--dark-gray);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.car-mileage::before {
    content: '\f3fd';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    font-size: 0.85rem;
}

/* ===== AZIONI AUTO ===== */
.car-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: white;
    text-decoration: none;
    opacity: 0.9;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.action-btn:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.edit-btn {
    background-color: #3498db;
}

.delete-btn {
    background-color: #e74c3c;
}

/* ===== FORM ADMIN ===== */
.admin-form {
    max-width: 1000px;
    margin: 0 auto;
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-color);
    background-color: #f9f9f9;
    transition: border-color 0.2s, background-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--secondary-color);
    background-color: white;
    outline: none;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

/* Checkbox grid per categorie */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    background-color: white;
    padding: 1rem;
    border-radius: 4px;
    border: 1px solid #eee;
    max-height: 200px;
    overflow-y: auto;
}

.category-checkbox {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.category-checkbox input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* ===== UPLOAD IMMAGINI ===== */
.image-upload-container {
    padding: 1.5rem;
    background-color: #f9f9f9;
    border-radius: 8px;
    border: 2px dashed #ddd;
    transition: border-color 0.2s;
}

.image-upload-container:hover {
    border-color: var(--secondary-color);
}

.image-upload {
    display: none;
}

.image-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 1rem auto;
    padding: 0.75rem 1.5rem;
    background-color: #eee;
    color: var(--text-color);
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: 600;
}

.image-upload-label:hover {
    background-color: #ddd;
}

.image-upload-instructions {
    text-align: center;
    color: #888;
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Anteprima immagini */
.image-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.image-preview {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview.main-image {
    border: 2px solid var(--secondary-color);
}

.main-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: var(--secondary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Immagini attuali nel form di modifica */
.current-images {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.car-image-item {
    width: 200px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    position: relative;
}

.image-container {
    position: relative;
    height: 150px;
    overflow: hidden;
}

.image-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-controls {
    padding: 0.75rem;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
}

.image-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: normal;
    font-size: 0.875rem;
}

/* ===== PAGINAZIONE ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 2rem 0 1rem;
}

.pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 0.75rem;
    background-color: white;
    border-radius: 4px;
    color: #555;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.pagination-item:hover {
    background-color: #f8f9fa;
    color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pagination-item.active {
    background-color: var(--secondary-color);
    color: white;
}

/* ===== MESSAGGIO NESSUN RISULTATO ===== */
.no-results {
    text-align: center;
    padding: 3rem 2rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    color: #666;
    font-size: 1.1rem;
    margin: 2rem 0;
}

.no-results a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.no-results a:hover {
    text-decoration: underline;
    color: #b01d1d;
}

/* ===== STILI PULSANTI ===== */
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.button.primary {
    background-color: var(--secondary-color);
    color: white;
}

.button.primary:hover {
    background-color: #b01d1d;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.button.secondary {
    background-color: #f8f9fa;
    color: var(--text-color);
    border: 1px solid #eaecef;
}

.button.secondary:hover {
    background-color: #eaecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ===== STILI RESPONSIVE ===== */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .add-button, .back-button {
        width: 100%;
        justify-content: center;
    }
    
    .cars-grid.admin-cars {
        grid-template-columns: 1fr;
    }
    
    .car-item {
        flex-direction: row;
    }
    
    .car-image {
        width: 100px;
    }
    
    .pagination {
        flex-wrap: wrap;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .button {
        width: 100%;
    }
    
    .current-images {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .car-item {
        flex-direction: column;
    }
    
    .car-image {
        width: 100%;
        height: 180px;
    }
    
    .car-actions {
        position: relative;
        top: auto;
        right: auto;
        justify-content: flex-end;
        margin-top: 1rem;
    }
    
    .admin-form {
        padding: 1.5rem;
    }
}