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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 10px;
}

.logo i {
    font-size: 2.5rem;
    color: #ffd700;
}

.logo h1 {
    font-size: 2.5rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

/* Upload Area */
.upload-area {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 2px dashed #ddd;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.upload-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 20px;
    opacity: 0.7;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #333;
    font-weight: 600;
}

.upload-content p {
    color: #666;
    margin-bottom: 25px;
    font-size: 1rem;
}

.upload-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

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

.btn-secondary {
    background: #f8f9fa;
    color: #333;
    border: 2px solid #e9ecef;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* Images Grid */
.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Enhanced Image Card Styles */
.image-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    transform-origin: center;
    will-change: transform, box-shadow;
}

.image-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.image-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform;
    backface-visibility: hidden;
}

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

.image-card.expanded {
    grid-column: span 2;
    grid-row: span 2;
    transform: scale(1);
    z-index: 1;
}

.image-card.expanded img {
    height: 400px;
    object-fit: contain;
    background: #f8f9fa;
    transform: scale(1);
}

.image-card.super-expanded {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2000;
    background: rgba(0,0,0,0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    border-radius: 0;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-card.super-expanded img {
    width: auto;
    max-width: 95vw;
    max-height: 85vh;
    height: auto;
    object-fit: contain;
    background: transparent;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.3);
    animation: zoomIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-card.super-expanded .image-info {
    background: rgba(255,255,255,0.95);
    border-radius: 10px;
    margin-top: 20px;
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    max-width: 90vw;
}

.image-card.super-expanded .image-actions {
    justify-content: center;
}

.image-card.super-expanded .close-super {
    position: absolute;
    top: 30px;
    right: 30px;
    background: #ff4757;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: background 0.2s;
}

.image-card.super-expanded .close-super:hover {
    background: #ff3742;
}

.image-info {
    padding: 15px;
}

.image-info h4 {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 5px;
    font-weight: 600;
}

.image-info p {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 10px;
}

.image-actions {
    display: flex;
    gap: 8px;
}

.image-actions button {
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    flex: 1;
}

.delete-btn {
    background: #ff4757;
    color: white;
}

.delete-btn:hover {
    background: #ff3742;
}

/* Instructions */
.instructions {
    margin-top: 40px;
}

.instruction-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.instruction-card i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 15px;
    display: block;
}

.instruction-card h4 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.instruction-card ol {
    padding-left: 20px;
}

.instruction-card li {
    margin-bottom: 8px;
    color: #555;
    font-size: 1rem;
}

/* Tips Section */
.tips-section {
    margin-top: 30px;
}

.tip-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(102, 126, 234, 0.1);
    position: relative;
    overflow: hidden;
}

.tip-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.tip-card i {
    font-size: 1.5rem;
    color: #667eea;
    margin-bottom: 10px;
    display: block;
}

.tip-card h4 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tip-content {
    position: relative;
    z-index: 1;
}

.tip-item {
    background: rgba(102, 126, 234, 0.05);
    padding: 12px 15px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-size: 0.9rem;
    color: #555;
    transition: all 0.2s ease;
}

.tip-item:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateX(5px);
}

.tip-item strong {
    color: #667eea;
    font-weight: 600;
}

.tip-note {
    background: rgba(102, 126, 234, 0.1);
    padding: 12px 15px;
    border-radius: 8px;
    margin-top: 15px;
    font-weight: 500;
    color: #333;
    text-align: center;
    border: 1px solid rgba(102, 126, 234, 0.2);
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 40px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* Enhanced Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: white;
    color: #333;
    padding: 12px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 3000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    max-width: 90vw;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0,0,0,0.1);
}

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

.toast i {
    font-size: 1.2rem;
}

.toast.success {
    background: #4CAF50;
    color: white;
}

.toast.error {
    background: #f44336;
    color: white;
}

.toast.info {
    background: #2196F3;
    color: white;
}

.toast.warning {
    background: #ff9800;
    color: white;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #666;
    background: rgba(255,255,255,0.97);
    border-radius: 18px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.10);
    max-width: 400px;
    margin: 40px auto 0 auto;
    animation: fadeIn 0.5s;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .upload-area {
        padding: 30px 20px;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .image-card.expanded {
        grid-column: span 1;
        grid-row: span 1;
    }
    
    .image-card.expanded img {
        height: 300px;
    }
    
    .image-card.super-expanded img {
        max-width: 98vw;
        max-height: 60vh;
    }
    
    .image-card.super-expanded .image-info {
        padding: 10px 8px;
    }
    
    .upload-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .btn {
        width: 100%;
        max-width: 250px;
        justify-content: center;
    }
    
    .toast {
        right: 10px;
        left: 10px;
        transform: translateY(-100px);
    }
    
    .toast.show {
        transform: translateY(0);
    }
}

@media (max-width: 480px) {
    .logo {
        flex-direction: column;
        gap: 10px;
    }
    
    .logo h1 {
        font-size: 1.8rem;
    }
    
    .upload-area {
        padding: 25px 15px;
    }
    
    .images-grid {
        grid-template-columns: 1fr;
    }
    
    .image-card.expanded img {
        height: 250px;
    }
    
    .image-card.super-expanded img {
        max-width: 100vw;
        max-height: 40vh;
    }
    
    .image-card.super-expanded .image-info {
        padding: 6px 2px;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Enhanced Animations */
@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.image-card {
    animation: fadeIn 0.5s ease-out;
}

/* PWA Install Prompt */
.install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: white;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transform: translateY(200px);
    transition: transform 0.3s ease;
    z-index: 999;
}

.install-prompt.show {
    transform: translateY(0);
}

.install-prompt .prompt-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.install-prompt .prompt-actions {
    display: flex;
    gap: 10px;
}

.install-prompt button {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.install-prompt .install-btn {
    background: #667eea;
    color: white;
}

.install-prompt .dismiss-btn {
    background: #f8f9fa;
    color: #666;
    border: 1px solid #e9ecef;
}

/* Enhanced Context Menu */
.context-menu {
    position: fixed;
    background: white;
    border-radius: 12px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    z-index: 3000;
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.context-menu.show {
    opacity: 1;
    transform: scale(1) translateY(0);
}

.context-menu-item {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.context-menu-item:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
}

.context-menu-item i {
    width: 20px;
    text-align: center;
    color: #667eea;
}

.context-menu-separator {
    height: 1px;
    background: rgba(0,0,0,0.1);
    margin: 8px 0;
}

/* Keyboard Shortcuts Hint */
.keyboard-hint {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 998;
}

.keyboard-hint.show {
    opacity: 1;
}

.keyboard-hint kbd {
    background: #333;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    margin: 0 2px;
} 

/* Enhanced Image Viewer */
.image-viewer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-viewer-content {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-viewer-img-container {
    position: relative;
    transform-origin: center;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
}

.image-viewer-img-container.grabbing {
    cursor: grabbing;
}

.image-viewer-img {
    max-width: none;
    max-height: none;
    transform-origin: center;
    will-change: transform;
    transition: transform 0.1s ease-out;
    pointer-events: none;
}

.image-viewer-toolbar {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    gap: 15px;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 2001;
}

.image-viewer-button {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
}

.image-viewer-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.image-viewer-button:active {
    transform: translateY(1px);
}

.image-viewer-button.active {
    background: rgba(102, 126, 234, 0.5);
    color: white;
}

.image-viewer-zoom-level {
    color: white;
    font-size: 0.9rem;
    padding: 0 10px;
    min-width: 80px;
    text-align: center;
    font-family: monospace;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    height: 30px;
    line-height: 30px;
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    z-index: 2001;
}

.image-viewer-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.image-viewer-info {
    position: absolute;
    top: 20px;
    left: 20px;
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 2001;
}

.image-viewer-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: white;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 2001;
    font-size: 1.5rem;
}

.image-viewer-nav:hover {
    transform: translateY(-50%) scale(1.1);
}

.image-viewer-nav.prev {
    left: 20px;
}

.image-viewer-nav.next {
    right: 20px;
}

.image-viewer-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 2rem;
    animation: spin 1s linear infinite;
} 