/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #a8c5e6 0%, #c1d9f0 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #e8e8e8;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    border: 20px solid #1e3c72;
}

/* Header */
header {
    background: white;
    padding: 30px 20px;
    text-align: center;
    border-bottom: 3px solid #1e3c72;
}

.logo {
    max-width: 400px;
    width: 100%;
    height: auto;
}

main {
    padding: 40px 30px;
    background: #e8e8e8;
}

h1 {
    color: #2d3748;
    font-size: 28px;
    margin-bottom: 10px;
    text-align: center;
}

.subtitle {
    color: #718096;
    text-align: center;
    margin-bottom: 30px;
    font-size: 16px;
}

/* Instructions */
.instructions {
    background: white;
    border-radius: 10px;
    padding: 20px 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 0;
}

.instruction-item:not(:last-child) {
    border-bottom: 1px solid #e2e8f0;
}

.instruction-number {
    width: 30px;
    height: 30px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    flex-shrink: 0;
}

/* Photo Count */
.photo-count {
    text-align: center;
    font-size: 18px;
    color: #4a5568;
    margin-bottom: 20px;
}

.photo-count span {
    font-weight: bold;
    color: #1e3c72;
    font-size: 24px;
}

/* Download Section */
.download-section {
    text-align: center;
    margin-bottom: 30px;
}

.download-section.bottom {
    margin-top: 30px;
    margin-bottom: 0;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 40px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.4);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 60, 114, 0.5);
}

.download-btn:active {
    transform: translateY(0);
}

.download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-icon {
    font-size: 22px;
}

.download-note {
    color: #718096;
    font-size: 13px;
    margin-top: 10px;
}

/* Gallery Container */
.gallery-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

/* Individual Photo Item */
.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: grab;
    transition: all 0.2s;
    background: #f0f0f0;
    border: 3px solid transparent;
}

.photo-item:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #1e3c72;
}

.photo-item:active {
    cursor: grabbing;
}

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

/* Photo Number Badge */
.photo-number {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(30, 60, 114, 0.9);
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
    min-width: 28px;
    text-align: center;
}

/* Delete Button */
.delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: rgba(220, 53, 69, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    z-index: 10;
}

.photo-item:hover .delete-btn {
    opacity: 1;
}

.delete-btn:hover {
    background: rgba(200, 35, 51, 1);
    transform: scale(1.1);
}

.delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Deleting State */
.photo-item.deleting {
    opacity: 0.5;
    pointer-events: none;
}

.photo-item {
    transition: all 0.3s ease;
}

/* Drag Ghost Styling */
.photo-item.sortable-ghost {
    opacity: 0.4;
    border: 3px dashed #1e3c72;
}

.photo-item.sortable-chosen {
    box-shadow: 0 8px 25px rgba(30, 60, 114, 0.4);
    transform: scale(1.05);
}

.photo-item.sortable-drag {
    opacity: 1;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e2e8f0;
    border-top-color: #1e3c72;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-state p {
    color: #718096;
    font-size: 16px;
}

/* Error State */
.error-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff5f5;
    border-radius: 10px;
    border: 2px solid #feb2b2;
}

.error-state p {
    color: #c53030;
    font-size: 16px;
    margin-bottom: 10px;
}

.error-detail {
    font-size: 13px;
    color: #718096;
}

/* Footer */
footer {
    background: white;
    padding: 20px;
    text-align: center;
    color: #718096;
    font-size: 14px;
    border-top: 1px solid #e2e8f0;
}

footer a {
    color: #1e3c72;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

footer p:first-child {
    margin-bottom: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-width: 12px;
    }

    main {
        padding: 30px 20px;
    }

    h1 {
        font-size: 24px;
    }

    .logo {
        max-width: 280px;
    }

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

    .instructions {
        padding: 15px 20px;
    }

    .instruction-item {
        font-size: 14px;
    }

    .download-btn {
        padding: 14px 30px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .photo-gallery {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .photo-number {
        font-size: 10px;
        padding: 3px 6px;
    }

    .instruction-item {
        font-size: 13px;
        gap: 10px;
    }

    .instruction-number {
        width: 25px;
        height: 25px;
        font-size: 12px;
    }
}

/* Image Loading Placeholder */
.photo-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Lightbox (for clicking to enlarge - future enhancement) */
.lightbox-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.lightbox-overlay.active {
    display: flex;
}

.lightbox-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
}

/* Custom Confirm Modal (replaces native confirm) */
.custom-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 4000;
    display: none;
    align-items: center;
    justify-content: center;
}
.custom-modal-overlay.active {
    display: flex;
}
.custom-modal-box {
    background: white;
    max-width: 400px;
    width: 90%;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}
@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}
.custom-modal-header {
    padding: 20px 25px;
    background: #fee2e2;
    border-bottom: 1px solid #fecaca;
    display: flex;
    align-items: center;
    gap: 12px;
}
.custom-modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #dc2626;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.custom-modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}
.custom-modal-body {
    padding: 25px;
    font-size: 15px;
    line-height: 1.6;
    color: #4b5563;
}
.custom-modal-footer {
    padding: 15px 25px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}
.custom-modal-btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}
.custom-modal-btn.primary {
    background: #dc2626;
    color: white;
}
.custom-modal-btn.primary:hover {
    background: #b91c1c;
}
.custom-modal-btn.secondary {
    background: #e5e7eb;
    color: #4b5563;
}
.custom-modal-btn.secondary:hover {
    background: #d1d5db;
}
