/* Photo Picker Page Styles */
/* Override page-level spacing to bring content closer to sidebar */
body:has(.photo-picker-container) .page {
    margin-left: var(--sidebar-width-expanded, 240px) !important;
    padding-left: 0 !important;
}

body:has(.photo-picker-container) .main-content {
    padding-left: 0 !important;
}

body:has(.photo-picker-container) main {
    padding-left: 0 !important;
}

body:has(.photo-picker-container) .content {
    padding-left: 20px !important;
}

.photo-picker-container {
    min-height: 100vh;
    background: var(--color-background);
    margin: 0 !important;
    padding: 0 !important;
}

.picker-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 24px 16px 24px 20px; /* Increased left padding slightly */
}

.header-content h1 {
    margin: 0 0 20px 0;
    font-size: 28px;
    font-weight: 600;
    color: var(--color-text);
    display: flex;
    align-items: center;
    gap: 12px;
}

.filters {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-group label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.filter-select,
.filter-input {
    padding: 12px 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    font-size: 14px;
    min-width: 200px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.filter-select:hover,
.filter-input:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.filter-select option {
    background: #1e1e1e;
    color: #ffffff;
    padding: 10px;
}

.counter {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 20px;
    background: var(--color-primary);
    border-radius: var(--radius-sm);
    color: white;
}

.counter-value {
    font-size: 24px;
    font-weight: 700;
}

.counter-label {
    font-size: 12px;
    opacity: 0.9;
}

/* Background Save Indicator */
.background-save-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: rgba(255, 204, 0, 0.15);
    border: 1px solid rgba(255, 204, 0, 0.3);
    border-radius: var(--radius-sm);
    color: #ffcc00;
    font-size: 14px;
    font-weight: 500;
    animation: pulse 2s ease-in-out infinite;
}

.background-save-indicator .spinner-sm {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 204, 0, 0.3);
    border-top-color: #ffcc00;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Loading & Empty States */
.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state h2 {
    margin: 20px 0 10px 0;
    color: var(--color-text);
}

.empty-state p {
    color: var(--color-text-secondary);
}

/* Picker Content */
.picker-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 32px 32px 4px;
}

.vehicle-info {
    margin-bottom: 32px;
    padding-left: 20px; /* Match the content padding */
}

.vehicle-info h2 {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text);
    margin: 0 0 12px 0;
}

.vehicle-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    font-size: 16px;
    color: var(--color-text-secondary);
    margin-bottom: 8px;
}

.vehicle-meta strong {
    color: var(--color-text);
}

.vehicle-meta .stock {
    font-family: 'Courier New', monospace;
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 4px;
}

.listing-link {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.listing-link:hover {
    color: #4da3ff;
    text-decoration: underline;
}

.progress-indicator {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--color-text-secondary);
}

/* Photo Grid */
.photo-grid-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px 16px 20px 20px; /* Increased left padding slightly */
    margin-bottom: 24px;
}

.photo-grid-section h3 {
    margin: 0 0 16px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.photo-item {
    position: relative;
    aspect-ratio: 4/3;
    border-radius: var(--radius-sm);
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
}

.photo-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.photo-item.selected {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.3);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Sequential loading placeholder - shows gray box until image loads */
.photo-item img.sequential-load:not(.loaded) {
    background: linear-gradient(135deg, #2a2a2a 0%, #3a3a3a 100%);
    min-height: 150px;
}

/* Fade in effect when image loads */
.photo-item img.sequential-load.loaded {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

.fullsize-icon {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 20px;
    height: 20px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    cursor: pointer;
    z-index: 10;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    opacity: 0;
    color: white;
    line-height: 1;
}

.photo-item:hover .fullsize-icon {
    opacity: 0.7;
}

.fullsize-icon:hover {
    background: rgba(0, 122, 255, 0.8);
    opacity: 1 !important;
    transform: scale(1.05);
}

.selection-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

.photo-count {
    text-align: center;
    font-size: 14px;
    color: var(--color-text-secondary);
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
}

.no-photos {
    text-align: center;
    padding: 40px;
    color: var(--color-text-secondary);
}

/* Attributes Section */
.attributes-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px 16px 20px 20px; /* Increased left padding slightly */
    margin-bottom: 24px;
}

.attribute-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.attribute-group label {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.original-value {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    padding: 4px 0;
}

.attribute-select {
    padding: 12px 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text);
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.attribute-select:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.attribute-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

.attribute-select option {
    background: #1e1e1e;
    color: #ffffff;
    padding: 10px;
}

/* Descriptions Section */
.descriptions-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 20px 16px 20px 20px; /* Increased left padding slightly */
    margin-bottom: 24px;
}

.descriptions-section h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text);
}

.descriptions-note {
    color: var(--color-text-secondary);
    font-size: 14px;
    margin: 0 0 16px 0;
}

.salesmen-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(0, 122, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--color-primary);
    font-weight: 500;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 32px;
}

.action-buttons button {
    min-width: 140px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-buttons button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.action-buttons button:active {
    transform: translateY(0);
}

.action-buttons button:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.action-buttons button:disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Prominent Save & Next button */
.btn-primary-prominent:not(:disabled) {
    background: linear-gradient(135deg, #0066ff 0%, #00cc88 100%);
    font-weight: 600;
    font-size: 1.05em;
    box-shadow: 0 4px 16px rgba(0, 102, 255, 0.4);
    animation: pulse-glow 2s ease-in-out infinite;
}

.btn-primary-prominent:not(:disabled):hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 102, 255, 0.5);
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 4px 16px rgba(0, 102, 255, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 204, 136, 0.5);
    }
}

/* Results */
.error-message {
    margin-top: 16px;
    padding: 16px;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    border-radius: var(--radius-sm);
    color: #ff3b30;
    text-align: center;
}

.save-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius-sm);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 500;
}

.save-result.success {
    background: rgba(52, 199, 89, 0.1);
    border: 1px solid rgba(52, 199, 89, 0.3);
    color: #34c759;
}

.save-result.error {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.3);
    color: #ff3b30;
}

/* Responsive */
@media (max-width: 768px) {
    .picker-header {
        padding: 16px;
    }

    .filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-select,
    .filter-input {
        width: 100%;
        min-width: unset;
    }

    .picker-content {
        padding: 16px;
    }

    .vehicle-info h2 {
        font-size: 24px;
    }

    .vehicle-meta {
        flex-wrap: wrap;
        font-size: 14px;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 8px;
    }

    .attributes-section {
        grid-template-columns: 1fr;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons button {
        width: 100%;
    }
}

/* Full Size Photo Modal - Compact Popup Style */
.photo-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
    from { 
        opacity: 0;
    }
    to { 
        opacity: 1;
    }
}

.modal-photo-container {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 80vw;
    max-height: 85vh;
    cursor: default;
    animation: slideIn 0.2s ease;
}

@keyframes slideIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10001;
    line-height: 1;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.modal-photo {
    width: 100%;
    height: auto;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

