/* JST Auto - Mobile-First Responsive CSS */

/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== VARIABLES ===== */
:root {
    /* Primary colors set dynamically in header.php from database */
    --success: #10b981;
    --info: #17a2b8;
    --danger: #ef4444;
    --warning: #f59e0b;
    --text: #1e293b;
    --text-light: #64748b;
    --bg: #f1f5f9;
    --border: #e2e8f0;
    --white: #ffffff;
}

/* ===== BASE ===== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 16px;
}

/* ===== HEADER ===== */
.header {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    height: 40px;
    width: auto;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    font-size: 0.9rem;
}

.user-name {
    font-weight: 500;
    display: none;
}

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.3);
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 2rem auto 0 auto;
    padding: 1rem;
}

/* ===== PAGE HEADER ===== */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.page-icon {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
    flex-shrink: 0;
}

.page-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--text-light);
    color: white;
}

.btn-secondary:hover {
    background: #475569;
}

.btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ===== SEARCH BAR ===== */
.search-controls {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-form {
    display: flex;
    gap: 0.75rem;
    flex: 1;
    min-width: 200px;
}

.search-input {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    min-width: 0;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.dashboard-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s;
    text-decoration: none;
    color: var(--text);
    border: 2px solid transparent;
}

.dashboard-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(8,145,178,0.2);
    border-color: var(--primary-color);
}

.dashboard-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 0.75rem;
    color: var(--primary-color);
    stroke-width: 2;
}

.dashboard-icon-fa {
    font-size: 48px;
    color: var(--primary-color);
    margin-bottom: 0.75rem;
    display: block;
}

.dashboard-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

/* ===== VEHICLE CARDS ===== */
.vehicles-grid {
    display: grid;
    gap: 1rem;
}

.vehicle-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.vehicle-image-container {
    position: relative;
    background: var(--bg);
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.vehicle-360-badge {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

.vehicle-details {
    padding: 1rem;
}

.vehicle-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.vehicle-owner {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.vehicle-transmission {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.vehicle-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-label {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.info-value.price {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.vehicle-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ===== STATUS BADGE ===== */
.status-badge {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status-badge.available {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.sold {
    background: #fee2e2;
    color: #991b1b;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ===== CARD ===== */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    padding: 1rem;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-logo {
    text-align: center;
    margin-bottom: 1.5rem;
}

.login-logo img {
    max-width: 200px;
    max-height: 120px;
    height: auto;
    width: auto;
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ===== ALERTS ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger);
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success);
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-light);
}

.empty-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    opacity: 0.3;
}

/* ===== TABLET (640px+) ===== */
@media (min-width: 640px) {
    .container {
        padding: 1.5rem;
    }
    
    .user-name {
        display: block;
    }
    
    .page-title {
        font-size: 1.75rem;
    }
    
    .page-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .page-title {
        margin-bottom: 0;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
    
    .dashboard-icon {
        width: 56px;
        height: 56px;
    }
    
    .dashboard-title {
        font-size: 1.1rem;
    }
    
    .vehicle-image-container {
        height: 220px;
    }
    
    .vehicle-info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .login-card {
        padding: 2.5rem 2rem;
    }
}

/* ===== DESKTOP (1024px+) ===== */
@media (min-width: 1024px) {
    .container {
        padding: 2rem;
    }
    
    .page-title {
        font-size: 2rem;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 1.5rem;
    }
    
    .dashboard-card {
        padding: 2rem 1.5rem;
    }
    
    .dashboard-icon {
        width: 64px;
        height: 64px;
    }
    
    .dashboard-title {
        font-size: 1.25rem;
    }
    
    .vehicle-card {
        display: grid;
        grid-template-columns: 280px 1fr;
        gap: 1.5rem;
    }
    
    .vehicle-image-container {
        height: auto;
    }
    
    .vehicle-details {
        padding: 1.5rem;
    }
    
    .vehicle-info-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
}

/* ===== LARGE DESKTOP (1280px+) ===== */
@media (min-width: 1280px) {
    .dashboard-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .vehicle-card {
        grid-template-columns: 320px 1fr;
    }
}

/* Clickable Images */
.vehicle-image-container a {
    display: block;
    cursor: pointer;
    position: relative;
}

.vehicle-image-container a:hover .vehicle-image {
    opacity: 0.9;
    transform: scale(1.02);
    transition: all 0.2s;
}

.vehicle-image-container a::after {
    content: '🔍';
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0,0,0,0.6);
    color: white;
    padding: 0.5rem;
    border-radius: 50%;
    font-size: 1.2rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.vehicle-image-container a:hover::after {
    opacity: 1;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

/* Image Slider */
.image-slider {
    position: relative;
    width: 100%;
    height: 100%;
}

.slider-image {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
}

.slider-image.active {
    display: block;
}

.slider-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 18px;
    border-radius: 4px;
    z-index: 10;
}

.slider-btn:hover {
    background: rgba(0,0,0,0.8);
}

.slider-btn.prev {
    left: 10px;
}

.slider-btn.next {
    right: 10px;
}

.slider-dots {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255,255,255,0.5);
    cursor: pointer;
}

.dot.active {
    background: white;
}

/* Image Preview */
.image-preview-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.image-preview {
    position: relative;
    width: 100%;
    padding-top: 100%;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--border);
}

.image-preview img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    z-index: 10;
}

.image-preview-remove:hover {
    background: #dc2626;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-paid {
    background: var(--success);
    color: white;
}

.status-unpaid {
    background: var(--warning);
    color: white;
}

.status-active {
    background: var(--info);
    color: white;
}

/* ===== CUSTOM CONTAINERS WITH SPACING ===== */
.sales-report-container,
.details-container,
.job-details-container,
.invoice-container,
.users-container,
.admin-container {
    max-width: 1200px;
    margin: 2rem auto 0 auto;
    padding: 1rem;
}
