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

:root {
    /* Logo-inspired purple color palette */
    --primary: #4e0052;
    --primary-dark: #3a003d;
    --primary-light: #7a007f;
    --primary-lighter: #a600ad;
    --success: #34C759;
    --error: #FF3B30;
    --warning: #FF9500;
    
    /* Glass morphism colors */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.18);
    --glass-shadow: rgba(0, 0, 0, 0.1);
    
    /* Text colors */
    --text-primary: rgba(0, 0, 0, 0.85);
    --text-secondary: rgba(0, 0, 0, 0.6);
    --text-tertiary: rgba(0, 0, 0, 0.4);
    --text-white: rgba(255, 255, 255, 0.95);
    
    /* Background gradients - Purple theme */
    --bg-gradient: linear-gradient(135deg, #4e0052 0%, #6b0071 25%, #880090 50%, #a500af 75%, #c200ce 100%);
    --bg-gradient-alt: linear-gradient(135deg, #f5f0f7 0%, #e8d5ed 100%);
    
    /* Shadows - Apple style */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.24);
    
    /* Blur */
    --blur-sm: blur(10px);
    --blur-md: blur(20px);
    --blur-lg: blur(40px);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.container {
    max-width: 840px;
    margin: 0 auto;
    background: var(--glass-bg);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    padding: 60px;
    position: relative;
    overflow: hidden;
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    pointer-events: none;
}

header {
    text-align: center;
    margin-bottom: 50px;
    position: relative;
    z-index: 1;
}

.logo-container {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo {
    height: 40px;
    width: auto;
    color: var(--primary);
    filter: drop-shadow(0 2px 8px rgba(78, 0, 82, 0.3));
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo:hover {
    transform: scale(1.05);
}

header h1 {
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-lighter) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 24px;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.description {
    color: var(--text-secondary);
    font-size: 17px;
    line-height: 1.7;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    padding: 28px 32px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    margin-bottom: 16px;
}

.description strong {
    color: var(--text-primary);
    font-size: 19px;
    display: block;
    margin-bottom: 14px;
    font-weight: 600;
}

.url-form-section {
    margin-bottom: 40px;
    position: relative;
    z-index: 1;
}

.input-group {
    margin-bottom: 32px;
}

.input-group label {
    display: block;
    margin-bottom: 14px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.4;
    letter-spacing: -0.2px;
}

.input-group input {
    width: 100%;
    padding: 20px 24px;
    border: 1.5px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    font-size: 17px;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.input-group input::placeholder {
    color: var(--text-tertiary);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 0 0 4px rgba(78, 0, 82, 0.1), var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transform: translateY(-1px);
}

.helper-text {
    display: block;
    margin-top: 16px;
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 18px 22px;
    background: rgba(78, 0, 82, 0.08);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    border-radius: 14px;
    border: 1px solid rgba(78, 0, 82, 0.15);
    box-shadow: var(--shadow-sm);
}

.helper-text strong {
    color: var(--primary);
    font-weight: 600;
}

.helper-note {
    display: block;
    margin-top: 10px;
    font-size: 14px;
    color: var(--text-tertiary);
    font-style: italic;
}

.btn {
    padding: 18px 32px;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    text-align: center;
    display: inline-block;
    letter-spacing: -0.2px;
    position: relative;
    overflow: hidden;
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    width: 100%;
    font-size: 19px;
    padding: 22px 36px;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, var(--primary-lighter) 0%, var(--primary) 100%);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #30D158 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    background: linear-gradient(135deg, #30D158 0%, var(--success) 100%);
}

.btn-secondary {
    background: rgba(142, 142, 147, 0.8);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    color: var(--text-white);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(142, 142, 147, 0.9);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:disabled {
    background: rgba(142, 142, 147, 0.3);
    color: rgba(255, 255, 255, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.status-area {
    margin-bottom: 32px;
    position: relative;
    z-index: 1;
}

.alert {
    padding: 20px 24px;
    border-radius: 16px;
    margin-bottom: 20px;
    font-size: 16px;
    line-height: 1.6;
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    border: 1px solid;
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.alert-error {
    background: rgba(255, 59, 48, 0.15);
    border-color: rgba(255, 59, 48, 0.3);
    color: #D70015;
}

.alert-info {
    background: rgba(78, 0, 82, 0.15);
    border-color: rgba(78, 0, 82, 0.3);
    color: var(--primary-dark);
}

.alert-success {
    background: rgba(52, 199, 89, 0.15);
    border-color: rgba(52, 199, 89, 0.3);
    color: #248A3D;
}

.alert-loading {
    background: rgba(255, 149, 0, 0.15);
    border-color: rgba(255, 149, 0, 0.3);
    color: #CC7700;
    display: flex;
    align-items: center;
    gap: 14px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 149, 0, 0.2);
    border-top-color: var(--warning);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    flex-shrink: 0;
}

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

.image-results {
    margin-top: 40px;
    position: relative;
    z-index: 1;
}

.product-header {
    margin-bottom: 36px;
    padding-bottom: 28px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.product-header h2 {
    font-size: 32px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
    word-break: break-word;
    line-height: 1.3;
    letter-spacing: -0.5px;
}

.product-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 28px;
}

.image-count-badge {
    background: linear-gradient(135deg, var(--success) 0%, #30D158 100%);
    color: var(--text-white);
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 16px;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

.image-count-badge strong {
    font-size: 18px;
}

.download-instruction {
    background: rgba(255, 149, 0, 0.1);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    padding: 22px 26px;
    border-radius: 16px;
    border: 1px solid rgba(255, 149, 0, 0.2);
    font-size: 16px;
    line-height: 1.7;
    color: var(--text-primary);
    margin-top: 24px;
    box-shadow: var(--shadow-sm);
}

.download-instruction strong {
    color: var(--warning);
    font-size: 17px;
    font-weight: 600;
}

.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    width: auto;
    font-size: 16px;
    padding: 14px 24px;
    min-width: 180px;
}

.action-buttons .btn-success {
    font-size: 17px;
    padding: 16px 28px;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 24px;
}

.image-card {
    background: var(--glass-bg);
    backdrop-filter: var(--blur-md);
    -webkit-backdrop-filter: var(--blur-md);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    position: relative;
}

.image-card > *:first-child {
    position: relative;
}

.image-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    pointer-events: none;
    z-index: 1;
}

.image-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-xl), inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.image-card img {
    width: 100%;
    display: block;
    object-fit: cover;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    aspect-ratio: 2 / 3;
    max-height: 400px;
    min-height: 200px;
}

.image-card img.lazy-image {
    opacity: 0.6;
    filter: blur(2px);
}

.image-card img.loaded {
    opacity: 1;
    filter: blur(0);
}

.image-card img.error {
    opacity: 0.8;
    filter: none;
}

.image-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1;
}

.image-loading::after {
    content: '';
    width: 32px;
    height: 32px;
    border: 3px solid rgba(78, 0, 82, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.no-images-container {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 40px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: var(--blur-sm);
    -webkit-backdrop-filter: var(--blur-sm);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-sm);
}

.no-images-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.6;
}

.no-images-container h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 12px;
    font-weight: 600;
}

.no-images-container p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

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

.image-card-info {
    padding: 20px;
}

.image-card-info .filename {
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 10px;
    word-break: break-word;
    line-height: 1.5;
    letter-spacing: -0.1px;
}

.image-card-info .position {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.image-card-info .btn {
    width: 100%;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--text-white);
    box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.image-card-info .btn:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-lighter) 0%, var(--primary) 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 32px 24px;
        border-radius: 20px;
    }

    .logo {
        height: 32px;
    }

    header h1 {
        font-size: 32px;
    }

    .description {
        font-size: 15px;
        padding: 22px 24px;
    }

    .description strong {
        font-size: 17px;
    }

    .input-group label {
        font-size: 16px;
    }

    .input-group input {
        padding: 18px 20px;
        font-size: 16px;
    }

    .helper-text {
        font-size: 14px;
        padding: 16px 20px;
    }

    .btn-primary {
        font-size: 17px;
        padding: 20px 28px;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
    }

    .product-header h2 {
        font-size: 26px;
    }

    .product-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .action-buttons {
        width: 100%;
    }

    .action-buttons .btn {
        flex: 1;
        min-width: 140px;
        font-size: 15px;
        padding: 14px 20px;
    }

    .action-buttons .btn-success {
        font-size: 16px;
    }

    .download-instruction {
        font-size: 15px;
        padding: 20px 22px;
    }
}

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background: rgba(0, 122, 255, 0.2);
    color: var(--text-primary);
}

