/* Modern Wishlist Styles */

/* CSS Variables for consistent theming - Apple Design System */
:root {
    --primary-color: #007AFF;
    --primary-hover: #0051D5;
    --primary-light: #E5F1FF;
    --secondary-color: #5AC8FA;
    --success-color: #34C759;
    --danger-color: #FF3B30;
    --warning-color: #FF9500;
    --text-dark: #1d1d1f;
    --text-medium: #6e6e73;
    --text-light: #86868b;
    --bg-light: #f5f5f7;
    --bg-white: #ffffff;
    --border-color: #d2d2d7;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
    --shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 8px 0 rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 16px 0 rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 16px 32px 0 rgba(0, 0, 0, 0.16);
    --radius-sm: 0.375rem;
    --radius: 0.625rem;
    --radius-lg: 0.875rem;
    --radius-xl: 1.25rem;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', sans-serif;
    margin: 0;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    background: linear-gradient(135deg, #F5F5F7 0%, #E8E8ED 50%, #D1D1D6 100%);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.47059;
    font-size: 17px;
    letter-spacing: -0.022em;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: saturate(180%) blur(20px);
    padding: 1rem 1rem;
    padding-top: calc(1rem + env(safe-area-inset-top));
    box-shadow: 0 1px 0 0 rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 0.5px solid rgba(0, 0, 0, 0.04);
    transition: transform 0.3s ease-in-out;
}

/* Hide header when scrolling down */
.header.header-hidden {
    transform: translateY(-100%);
}

@media (min-width: 768px) {
    .header {
        padding: 1.5rem 2rem;
    }
}

.header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@media (min-width: 768px) {
    .header h1 {
        font-size: 1.875rem;
    }
}

.header-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.header-button {
    padding: 0.625rem 1.25rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.header-button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Homepage Hero Section */
.hero-section {
    max-width: 800px;
    margin: 2rem auto;
    padding: 1rem 1.5rem;
    text-align: center;
}

.hero-title {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.hero-description {
    font-size: 1rem;
    color: var(--text-medium);
    margin-bottom: 0.75rem;
    line-height: 1.5;
}

.hero-privacy {
    font-size: 0.875rem;
    color: var(--success-color);
    font-weight: 600;
    margin-bottom: 2rem;
}

.hero-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

.button.hero-button-primary {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    text-decoration: none;
    background: var(--primary-color) !important;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.button.hero-button-primary:hover {
    background: var(--primary-hover) !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 122, 255, 0.4);
}

.button.hero-button-secondary {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    text-decoration: none;
    background: white !important;
    color: var(--text-dark) !important;
    border: 2px solid var(--border-color) !important;
    font-weight: 500;
}

.button.hero-button-secondary:hover {
    background: var(--bg-light) !important;
    border-color: var(--text-medium) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.features-grid {
    margin-top: 2.5rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    text-align: left;
}

.feature-card {
    background: white;
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.feature-title {
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.feature-description {
    color: var(--text-medium);
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* Responsive adjustments for larger screens */
@media (min-width: 768px) {
    .hero-section {
        margin: 4rem auto;
        padding: 2rem;
    }
    
    .hero-title {
        font-size: 3rem;
        margin-bottom: 1.5rem;
    }
    
    .hero-description {
        font-size: 1.25rem;
        margin-bottom: 1rem;
        line-height: 1.6;
    }
    
    .hero-privacy {
        font-size: 1rem;
        margin-bottom: 3rem;
    }
    
    .hero-buttons {
        gap: 1rem;
    }
    
    .button.hero-button-primary {
        padding: 1rem 2rem;
        font-size: 1.1rem;
        box-shadow: 0 6px 16px rgba(0, 122, 255, 0.3);
    }
    
    .button.hero-button-primary:hover {
        box-shadow: 0 8px 20px rgba(0, 122, 255, 0.4);
    }
    
    .button.hero-button-secondary {
        padding: 1rem 2rem;
        font-size: 1.1rem;
    }
    
    .features-grid {
        margin-top: 4rem;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 2rem;
    }
    
    .feature-card {
        padding: 2rem;
    }
    
    .feature-icon {
        font-size: 2.5rem;
        margin-bottom: 1rem;
    }
    
    .feature-title {
        font-size: 1.5rem;
    }
    
    .feature-description {
        font-size: 1rem;
    }
}

/* Homepage Header */
.homepage-header {
    justify-content: center;
}

/* Homepage Footer */
.homepage-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--text-medium);
    font-size: 0.8125rem;
    border-top: 1px solid var(--border-color);
    margin-top: 2.5rem;
}

@media (min-width: 768px) {
    .homepage-footer {
        padding: 2rem;
        font-size: 0.875rem;
        margin-top: 4rem;
    }
}

.settings-section p {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* Main Content */
.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Lists */
ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.item-list {
    display: grid;
    gap: 1.5rem;
}

/* Item Cards */
li.item {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin-bottom: 2rem;
}

li.item:last-child {
    margin-bottom: 0;
}

li.item.in-view {
    opacity: 1;
    transform: translateY(0) scale(1);
}

li.item:hover {
    transform: translateY(-4px) scale(1);
    box-shadow: var(--shadow-xl);
}

.item-details,
.item-details-admin {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.item-image {
    width: 100%;
    max-width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s ease;
}

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

.item-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    line-height: 1.3;
}

.item-status {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.item-bought-status {
    margin: 0;
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-medium);
}

.item-buy-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #007AFF 0%, #5AC8FA 50%, #007AFF 100%);
    background-size: 200% 200%;
    color: white;
    text-decoration: none;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    text-align: center;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
}

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

.item-buy-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 122, 255, 0.4);
    background-position: 100% 0;
}

.item-buy-link:hover::before {
    left: 100%;
}

.item-buy-link:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

/* Buttons */
button,
.button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    letter-spacing: -0.01em;
}

button:hover:not(:disabled),
.button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.button-delete {
    background: var(--danger-color);
}

.button-delete:hover {
    background: #dc2626;
}

/* Mark as Bought Button - Beautiful Green Gradient */
.mark-bought-btn,
.button[data-bought-action="mark"] {
    background: linear-gradient(135deg, #34C759 0%, #30D158 50%, #28CD41 100%);
    background-size: 200% 200%;
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
    position: relative;
    overflow: hidden;
}

.mark-bought-btn::before,
.button[data-bought-action="mark"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.mark-bought-btn:hover,
.button[data-bought-action="mark"]:hover {
    background-position: 100% 0;
    box-shadow: 0 6px 20px rgba(52, 199, 89, 0.4);
}

.mark-bought-btn:hover::before,
.button[data-bought-action="mark"]:hover::before {
    left: 100%;
}

.mark-bought-btn:active,
.button[data-bought-action="mark"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

/* Set as Bought button in admin (target by form action) */
form[action*="/toggle/"] button.button {
    background: linear-gradient(135deg, #34C759 0%, #30D158 50%, #28CD41 100%);
    background-size: 200% 200%;
    box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
    position: relative;
    overflow: hidden;
}

form[action*="/toggle/"] button.button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

form[action*="/toggle/"] button.button:hover {
    background-position: 100% 0;
    box-shadow: 0 6px 20px rgba(52, 199, 89, 0.4);
}

form[action*="/toggle/"] button.button:hover::before {
    left: 100%;
}

form[action*="/toggle/"] button.button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(52, 199, 89, 0.3);
}

/* Forms */
form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.admin-form,
.admin-form-small,
.admin-form-medium {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    margin: 1rem auto;
}

.admin-form-medium {
    width: 100%;
    max-width: 600px;
}

.admin-form-small {
    width: 100%;
    max-width: 250px;
}

label {
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: all 0.2s ease;
    background: var(--bg-white);
    min-height: 44px; /* Minimum touch target size */
}

.input-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 122, 255, 0.15);
}

/* Settings Section */
.settings-section {
    text-align: center;
    margin: 2rem auto;
    padding: 2rem;
    background: linear-gradient(135deg, #E5F1FF 0%, #D6E9FF 100%);
    border-radius: var(--radius-xl);
    max-width: 700px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0, 122, 255, 0.1);
}

.settings-section h2 {
    margin-top: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
}

/* URL Scraper Section */
.url-scraper-section {
    text-align: center;
    margin: 2rem auto;
    padding: 2rem;
    background: white;
    border-radius: var(--radius-xl);
    max-width: 700px;
    box-shadow: var(--shadow-lg);
}

.url-scraper-section h2 {
    margin-top: 0;
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 700;
}

#loading-indicator {
    margin-top: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

/* Form Divider */
.form-divider {
    text-align: center;
    margin: 3rem 0;
    position: relative;
}

.form-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    z-index: 0;
}

.form-divider span {
    background: var(--bg-light);
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
    color: var(--text-medium);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

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

.modal-content {
    background-color: var(--bg-white);
    margin: 3% auto;
    padding: 2.5rem;
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 1100px;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xl);
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close,
.close-edit,
.close-add {
    color: var(--text-medium);
    float: right;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s ease;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

.close:hover,
.close:focus,
.close-edit:hover,
.close-edit:focus,
.close-add:hover,
.close-add:focus {
    color: var(--danger-color);
    background: var(--bg-light);
}

#scraped-title {
    margin: 1.5rem 0 0.5rem;
    color: var(--text-dark);
    font-size: 1.75rem;
    font-weight: 700;
}

#image-count {
    color: var(--text-medium);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* Image Gallery */
#image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-top: 1.5rem;
}

.gallery-image-container {
    position: relative;
    cursor: pointer;
    border: 3px solid transparent;
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-light);
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-image-container::after {
    content: '✓ Select';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 122, 255, 0.95), transparent);
    color: white;
    padding: 1rem;
    font-weight: 600;
    font-size: 0.875rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-image-container:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
    box-shadow: var(--shadow-xl);
}

.gallery-image-container:hover::after {
    opacity: 1;
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: opacity 0.3s ease;
}

.gallery-image-container:hover .gallery-image {
    opacity: 0.9;
}

/* Change Properties Box */
.change-properties-box {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-lg);
}

/* Login Page */
body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    background: white;
    padding: 3rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 400px;
    width: 90%;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Responsive Design - Desktop */
@media (min-width: 768px) {
    .item-details,
    .item-details-admin {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }

    .item-image {
        max-width: 180px;
        height: 180px;
    }

    .item-details > *,
    .item-details-admin > * {
        flex: 0 1 auto;
    }

    .item-title {
        flex: 1 1 200px;
    }

    .item-list {
        grid-template-columns: repeat(auto-fill, minmax(700px, 1fr));
    }

    .change-properties-box {
        width: 100%;
    }

    /* Dashboard grid improvements */
    .dashboard-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}

/* Responsive Design - Mobile */
@media (max-width: 767px) {
    body {
        font-size: 18px; /* Slightly larger for better readability */
        line-height: 1.6; /* Improved line height */
    }

    .header {
        padding: 1rem;
        padding-top: calc(1rem + env(safe-area-inset-top));
        flex-direction: column;
        gap: 1rem;
    }

    .header h1 {
        font-size: 1.5rem;
        text-align: center;
        word-break: break-word; /* Better text truncation */
    }

    .header-buttons {
        flex-direction: row;
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-button {
        font-size: 0.9375rem;
        padding: 0.75rem 1.25rem; /* Increased padding for better touch target */
        min-height: 44px; /* Minimum touch target size */
        flex: 1 1 auto;
        min-width: 120px;
    }

    .main-content {
        padding: 1rem;
        padding-left: calc(1rem + env(safe-area-inset-left));
        padding-right: calc(1rem + env(safe-area-inset-right));
    }

    li.item {
        padding: 1.25rem;
    }

    /* Hide edit button on mobile - item itself is clickable */
    .item-actions .edit-item-btn {
        display: none;
    }

    /* Make item clickable on mobile */
    .edit-item-clickable {
        cursor: pointer;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .edit-item-clickable:active {
        transform: scale(0.98);
    }

    /* Prevent buttons/links inside from triggering item click */
    .edit-item-clickable .item-actions,
    .edit-item-clickable .item-actions *,
    .edit-item-clickable .item-buy-link {
        pointer-events: auto;
    }

    /* Stack item actions vertically on mobile */
    .item-actions {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }

    .item-actions button,
    .item-actions .button,
    .item-actions form {
        width: 100% !important;
        min-height: 44px; /* Minimum touch target size */
        padding: 0.875rem 1.25rem; /* Increased padding */
    }

    .item-image {
        max-width: 100%;
        height: 200px;
    }

    .item-title {
        font-size: 1.25rem;
        word-break: break-word; /* Better text truncation */
        line-height: 1.4; /* Improved line height */
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
        margin: 5% auto;
        max-height: 90vh;
    }

    #image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .gallery-image-container {
        min-height: 150px; /* Better touch target */
    }

    .settings-section,
    .url-scraper-section {
        margin: 1rem auto;
        padding: 1.5rem;
    }

    .admin-form-medium {
        width: 100%;
    }

    button,
    .button {
        width: 100%;
        justify-content: center;
        min-height: 44px; /* Minimum touch target size */
        padding: 0.875rem 1.25rem; /* Increased padding */
        font-size: 16px; /* Prevent zoom on iOS */
    }

    .item-buy-link {
        min-height: 44px; /* Minimum touch target size */
        padding: 0.875rem 1.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        /* Gradient styles preserved */
        background: linear-gradient(135deg, #007AFF 0%, #5AC8FA 50%, #007AFF 100%);
        background-size: 200% 200%;
        box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
    }

    .mark-bought-btn {
        /* Gradient styles preserved */
        background: linear-gradient(135deg, #34C759 0%, #30D158 50%, #28CD41 100%);
        background-size: 200% 200%;
        box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
    }

    form[action*="/toggle/"] button.button {
        /* Gradient styles preserved */
        background: linear-gradient(135deg, #34C759 0%, #30D158 50%, #28CD41 100%);
        background-size: 200% 200%;
        box-shadow: 0 4px 12px rgba(52, 199, 89, 0.3);
    }

    /* Improve input fields on mobile */
    .input-field {
        min-height: 44px; /* Minimum touch target size */
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* Better text truncation */
    h1, h2, h3 {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Loading indicator improvements */
    .spinner {
        width: 1.5rem;
        height: 1.5rem;
    }

    #loading-indicator::before {
        width: 1.5rem;
        height: 1.5rem;
    }

    /* Login container mobile improvements */
    .login-container {
        padding: 2rem 1.5rem;
        margin: 1rem;
    }

    .login-container h1 {
        font-size: 1.75rem;
        margin-bottom: 1.5rem;
    }

    /* Dashboard grid single column on mobile */
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    /* Dashboard card improvements */
    .dashboard-grid > div {
        padding: 1.25rem !important;
    }

    .dashboard-grid h3 {
        font-size: 1.125rem;
        word-break: break-word;
    }

    /* Dashboard card buttons stack on mobile */
    .dashboard-grid > div > div:last-child {
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    .dashboard-grid > div > div:last-child button,
    .dashboard-grid > div > div:last-child a {
        width: 100% !important;
        min-height: 44px;
        padding: 0.75rem 1rem;
    }

    /* Hide manage button on mobile - card itself is clickable */
    .manage-wishlist-btn {
        display: none !important;
    }

    /* Make wishlist card clickable on mobile */
    .wishlist-card-clickable {
        cursor: pointer;
        transition: transform 0.2s, box-shadow 0.2s;
    }

    .wishlist-card-clickable:active {
        transform: scale(0.98);
    }

    /* Prevent buttons/links inside from triggering card click */
    .wishlist-card-clickable button,
    .wishlist-card-clickable a,
    .wishlist-card-clickable .copy-link-btn,
    .wishlist-card-clickable .manage-wishlist-btn {
        pointer-events: auto;
    }
}

/* Very small screens (< 480px) */
@media (max-width: 480px) {
    body {
        font-size: 17px;
    }

    .header h1 {
        font-size: 1.25rem;
    }

    .header-button {
        font-size: 0.875rem;
        padding: 0.625rem 1rem;
        min-width: 100px;
    }

    .main-content {
        padding: 0.75rem;
        padding-left: calc(0.75rem + env(safe-area-inset-left));
        padding-right: calc(0.75rem + env(safe-area-inset-right));
    }

    li.item {
        padding: 1rem;
    }

    .item-title {
        font-size: 1.125rem;
    }

    /* Full-screen modals on very small screens */
    .modal-content {
        width: 100%;
        height: 100%;
        max-height: 100vh;
        margin: 0;
        border-radius: 0;
        padding: 1.5rem;
        padding-top: calc(1.5rem + env(safe-area-inset-top));
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    }

    .close,
    .close-edit,
    .close-add {
        position: fixed;
        top: calc(1rem + env(safe-area-inset-top));
        right: 1rem;
        z-index: 1001;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px);
    }

    #image-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }

    .settings-section,
    .url-scraper-section {
        padding: 1.25rem;
        margin: 0.75rem auto;
    }

    .login-container {
        padding: 1.5rem 1.25rem;
        margin: 0.5rem;
    }

    /* Settings page mobile improvements */
    /* Stack GDPR sections vertically on mobile */
    .settings-action-row {
        flex-direction: column !important;
        align-items: stretch !important;
    }

    /* Make description text full width on mobile */
    .settings-action-content {
        width: 100% !important;
        margin-bottom: 1rem;
    }

    /* Make buttons full width on mobile in settings */
    .settings-action-button {
        width: 100% !important;
        white-space: normal !important;
        justify-content: center;
    }
}

/* Loading Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

#loading-indicator::before {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--primary-light);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 0.5rem;
}

/* Smooth transitions for form highlight */
.admin-form-medium[action="/admin/add"] {
    transition: background-color 0.5s ease;
}

/* No items message */
.main-content > p {
    text-align: center;
    font-size: 1.25rem;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    padding: 2rem;
    border-radius: var(--radius-xl);
    backdrop-filter: blur(10px);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--text-light);
    border-radius: var(--radius);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-medium);
}
