/* 
   admin.css - Tyson Autogarage
   CSS for admin dashboard and PHP-driven pages 
*/

/* ===== ADMIN CONTAINER ===== */
.admin-container {
    padding: 2rem 0;
}

.admin-container .content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ===== ADMIN HEADER ===== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.admin-title {
    margin: 0;
    color: #333;
    font-size: 2rem;
    font-weight: 700;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    background-color: #cd2122;
    border-radius: 8px;
    margin-right: 1rem;
    color: white;
    font-size: 1.5rem;
}

.stat-content h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    color: #888;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #333;
}

/* ===== ACTION CARDS ===== */
.admin-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.section-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.action-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background-color: #f9f9f9;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
    text-decoration: none;
    color: #333;
}

.action-card:hover {
    background-color: #f5f5f5;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: #cd2122;
}

.action-text {
    font-weight: 600;
    text-align: center;
}

/* ===== TABLES ===== */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.admin-table thead {
    background-color: #f5f5f5;
    color: #333;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tbody tr:hover {
    background-color: #f9f9f9;
}

.text-center {
    text-align: center;
}

/* Action buttons in tables */
.actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    color: #fff;
    background-color: #555;
    transition: background-color 0.2s;
    text-decoration: none;
}

.edit-btn {
    background-color: #4c6ef5;
}

.edit-btn:hover {
    background-color: #3b5bdb;
}

.delete-btn {
    background-color: #cd2122;
}

.delete-btn:hover {
    background-color: #a61c1c;
}

/* ===== FORMS ===== */
.admin-form {
    max-width: 1000px;
    margin: 0 auto;
    background-color: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
}

.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: #333;
}

.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: #333;
    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: #cd2122;
    background-color: #fff;
    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 for categories */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5rem;
    background-color: #fff;
    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;
}

/* Image upload */
.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: #cd2122;
}

.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: #333;
    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;
}

/* Image preview */
.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 #cd2122;
}

.main-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background-color: #cd2122;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Current images in edit form */
.current-images {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-top: 0.5rem;
}

.car-image-item {
    width: 200px;
    background-color: #fff;
    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;
}

/* Car listing grid for admin */
.admin-cars {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.admin-cars .car-item {
    display: flex;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.admin-cars .car-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.admin-cars .car-image {
    width: 120px;
    overflow: hidden;
}

.admin-cars .car-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-cars .no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background-color: #f5f5f5;
    color: #999;
    font-size: 0.875rem;
    text-align: center;
    padding: 0.5rem;
}

.admin-cars .no-image i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.admin-cars .car-info {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.admin-cars h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.admin-cars .car-details {
    display: flex;
    margin-bottom: auto;
}

.admin-cars .car-price {
    font-weight: 700;
    color: #cd2122;
    margin-right: 1rem;
}

.admin-cars .car-mileage {
    color: #888;
}

.admin-cars .car-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    justify-content: flex-end;
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
}

.alert.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert ul {
    margin: 0.5rem 0 0 0;
    padding-left: 1.5rem;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.pagination-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: #f5f5f5;
    border-radius: 4px;
    color: #333;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.2s;
}

.pagination-item:hover {
    background-color: #e0e0e0;
}

.pagination-item.active {
    background-color: #cd2122;
    color: white;
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .actions-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-table {
        display: block;
        overflow-x: auto;
    }
    
    .admin-cars {
        grid-template-columns: 1fr;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .button {
        width: 100%;
    }
    
    .current-images {
        justify-content: center;
    }
}

/* ===== BUTTONS ===== */
.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.2s;
    border: none;
    font-family: inherit;
    font-size: 1rem;
}

.button.primary {
    background-color: #cd2122;
    color: white;
}

.button.primary:hover {
    background-color: #a61c1c;
}

.button.secondary {
    background-color: #f5f5f5;
    color: #333;
}

.button.secondary:hover {
    background-color: #e0e0e0;
}

.add-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== NO RESULTS MESSAGE ===== */
.no-results {
    text-align: center;
    padding: 3rem 1rem;
    color: #888;
    background-color: #f9f9f9;
    border-radius: 8px;
    margin: 2rem 0;
}

.no-results a {
    color: #cd2122;
    text-decoration: none;
    font-weight: 600;
}

.no-results a:hover {
    text-decoration: underline;
}

/* ===== IMAGE MANAGER ===== */
.image-manager {
    margin: 20px 0;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.image-preview {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #ddd;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-actions {
    position: absolute;
    top: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
}

.image-actions button {
    padding: 8px;
    border: none;
    border-radius: 4px;
    background: rgba(0,0,0,0.6);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-star.active {
    color: #ffd700;
}

.upload-zone {
    border: 3px dashed #ddd;
    border-radius: 8px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone:hover {
    border-color: #007bff;
}

.upload-zone label {
    display: block;
    cursor: pointer;
}

.upload-zone i {
    font-size: 2em;
    margin-bottom: 10px;
    color: #007bff;
}