/* ===========================================
   Portfolio Gallery Styles
   =========================================== */

/* Car Cards Grid */
.cars-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-lg);
}

@media (max-width: 1024px) {
    .cars-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .cars-grid {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

/* Car Card */
.car-card {
    background: linear-gradient(145deg, #111 0%, #0a0a0a 100%);
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all var(--transition-normal);
}

.car-card:hover {
    border-color: rgba(255, 90, 0, 0.3);
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(255, 90, 0, 0.1);
}

.car-card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 16/10;
    overflow: hidden;
}

.car-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.car-card:hover .car-card-image img {
    transform: scale(1.05);
}

.car-card-service {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--primary);
    color: var(--bg-dark);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.car-card-info {
    padding: var(--spacing-md);
}

.car-card-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--text-light);
    margin-bottom: 4px;
}

.car-card-year {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm);
}

.car-card-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: var(--spacing-md);
    line-height: 1.5;
}

/* Gallery Buttons */
.car-card-buttons {
    display: flex;
    gap: 10px;
}

.btn-gallery {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-gallery-before {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-gallery-before:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.btn-gallery-after {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--bg-dark);
}

.btn-gallery-after:hover {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary) 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 90, 0, 0.3);
}

/* Empty state for buttons */
.btn-gallery:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ===========================================
   Lightbox Gallery
   =========================================== */

.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox Header */
.lightbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lightbox-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    color: var(--text-light);
}

.lightbox-title span {
    color: var(--primary);
}

.lightbox-counter {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: 20px;
}

.lightbox-close {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: var(--primary);
    color: var(--bg-dark);
}

/* Lightbox Body */
.lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 20px;
    overflow: hidden;
}

.lightbox-image-container {
    max-width: 100%;
    max-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 180px);
    object-fit: contain;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.3s ease;
}

.lightbox-image.loaded {
    opacity: 1;
    transform: scale(1);
}

/* Navigation Arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.lightbox-nav:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--bg-dark);
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-nav:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lightbox-nav:disabled:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
}

/* Lightbox Thumbnails */
.lightbox-thumbnails {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    justify-content: center;
    -webkit-overflow-scrolling: touch;
}

.lightbox-thumb {
    width: 60px;
    height: 45px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    transition: all var(--transition-fast);
    flex-shrink: 0;
    border: 2px solid transparent;
}

.lightbox-thumb:hover {
    opacity: 0.8;
}

.lightbox-thumb.active {
    opacity: 1;
    border-color: var(--primary);
}

.lightbox-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Loading Spinner */
.lightbox-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Gallery Type Tabs in Lightbox */
.lightbox-tabs {
    display: flex;
    gap: 10px;
}

.lightbox-tab {
    padding: 8px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.lightbox-tab:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-light);
}

.lightbox-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--bg-dark);
}

/* ===========================================
   Mobile Styles
   =========================================== */

@media (max-width: 768px) {
    .lightbox-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 15px;
    }
    
    .lightbox-title {
        font-size: 1rem;
        order: 1;
        flex: 1;
    }
    
    .lightbox-close {
        order: 2;
        width: 40px;
        height: 40px;
    }
    
    .lightbox-tabs {
        order: 3;
        width: 100%;
        justify-content: center;
    }
    
    .lightbox-counter {
        order: 4;
        position: absolute;
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        z-index: 20;
    }
    
    .lightbox-body {
        padding: 10px;
    }
    
    .lightbox-nav {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .lightbox-prev {
        left: 10px;
    }
    
    .lightbox-next {
        right: 10px;
    }
    
    .lightbox-thumbnails {
        padding: 10px;
        gap: 8px;
        justify-content: flex-start;
    }
    
    .lightbox-thumb {
        width: 50px;
        height: 38px;
    }
    
    .lightbox-image {
        max-height: calc(100vh - 220px);
    }
}

/* Touch swipe hint */
.lightbox-swipe-hint {
    display: none;
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-muted);
    font-size: 0.8rem;
    opacity: 0.7;
}

@media (max-width: 768px) {
    .lightbox-swipe-hint {
        display: block;
    }
    
    .lightbox-nav {
        display: none;
    }
}

/* No images state */
.no-images-message {
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
    font-size: 1rem;
}