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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    padding: 30px 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 30px;
    border-radius: 0 0 20px 20px;
}

header h1 {
    font-size: 28px;
    font-weight: 600;
}

header p {
    margin-top: 10px;
    opacity: 0.9;
    font-size: 14px;
}

/* Upload Area */
.upload-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.drop-zone {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 50px 30px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: #fafafa;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #667eea;
    background: #f0f4ff;
}

.drop-zone-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.drop-zone-text {
    color: #666;
    margin-bottom: 20px;
}

.drop-zone-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: #f0f0f0;
    color: #333;
}

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

.btn-success {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
}

/* File Input Hidden */
#fileInput {
    display: none;
}

/* Upload Status */
.upload-status {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    display: none;
}

.upload-status.active {
    display: block;
}

.status-summary {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
}

.status-new {
    background: #d4edda;
    color: #155724;
}

.status-exists {
    background: #fff3cd;
    color: #856404;
}

.status-total {
    background: #e2e3e5;
    color: #383d41;
}

/* Progress Bar */
.progress-container {
    margin-top: 15px;
    display: none;
}

.progress-container.active {
    display: block;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    font-size: 14px;
    color: #666;
}

/* Preview Grid (Selected Files) */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    margin-top: 20px;
    max-height: 300px;
    overflow-y: auto;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item.is-duplicate {
    opacity: 0.5;
}

.preview-item .badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
}

.badge-new {
    background: #28a745;
}

.badge-exists {
    background: #ffc107;
    color: #333;
}

/* Gallery Section */
.gallery-section {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.gallery-header h2 {
    font-size: 22px;
    font-weight: 600;
}

.gallery-stats {
    font-size: 14px;
    color: #666;
}

/* Month Group */
.month-group {
    margin-bottom: 30px;
}

.month-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.month-header:hover {
    background: #f0f0f0;
}

.month-header h3 {
    font-size: 16px;
    font-weight: 600;
    flex: 1;
}

.month-header .count {
    font-size: 14px;
    color: #666;
    background: #e0e0e0;
    padding: 4px 12px;
    border-radius: 12px;
}

.month-header .toggle-icon {
    transition: transform 0.3s ease;
}

.month-header.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

/* Photo Grid */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.photo-grid.collapsed {
    display: none;
}

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.photo-item:hover {
    transform: scale(1.03);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-item .photo-date {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-item:hover .photo-date {
    opacity: 1;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #666;
}

/* Loading Spinner */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 14px;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    header {
        padding: 20px;
        margin-bottom: 20px;
    }

    header h1 {
        font-size: 22px;
    }

    .upload-section,
    .gallery-section {
        padding: 20px;
        border-radius: 12px;
    }

    .drop-zone {
        padding: 30px 20px;
    }

    .drop-zone-icon {
        font-size: 36px;
    }

    .btn {
        padding: 10px 18px;
        font-size: 14px;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 8px;
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    }
}

/* Lightbox Customization */
.lb-nav a.lb-prev,
.lb-nav a.lb-next {
    opacity: 0.8;
}

.lb-data .lb-caption {
    font-size: 14px;
}
