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

:root {
    --primary: #000000;
    --primary-dark: #1a1a1a;
    --primary-light: #333333;
    --accent: #ffffff;
    --accent-gray: #f5f5f5;
    --text: #000000;
    --text-light: #666666;
    --text-lighter: #999999;
    --bg: #ffffff;
    --bg-gray: #f9f9f9;
    --bg-dark: #1a1a1a;
    --border: #e0e0e0;
    --border-dark: #333333;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.2);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 50%, #f9f9f9 100%);
    min-height: 100vh;
    padding: 0;
    position: relative;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--bg);
    border-radius: 16px;
    padding: 50px;
    box-shadow: 0 10px 40px var(--shadow-lg);
    position: relative;
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .container {
        padding: 0 14px 48px !important;
        border-radius: 0;
        max-width: 100%;
        width: 100%;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
    }
}

.logo-header {
    text-align: center;
    margin-bottom: 30px;
}

.main-logo {
    max-height: 80px;
    max-width: 200px;
    object-fit: contain;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .main-logo {
        max-height: 60px;
        max-width: 150px;
        margin-bottom: 15px;
    }
    
    .logo-header {
        margin-bottom: 20px;
    }
}

h1 {
    text-align: center;
    color: var(--text);
    margin-bottom: 24px;
    font-size: 3em;
    font-weight: 800;
    letter-spacing: -0.02em;
    text-transform: uppercase;
}

/* List type tabs: WTB / Want to Consign */
.list-type-tabs {
    display: flex;
    gap: 0;
    justify-content: center;
    margin-bottom: 28px;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    background: var(--bg-gray);
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.list-tab {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-light);
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.list-tab:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.05);
}

.list-tab.active {
    background: var(--primary);
    color: var(--accent);
}

@media (max-width: 768px) {
    .list-type-tabs {
        margin-bottom: 20px;
        padding: 3px;
    }
    .list-tab {
        padding: 12px 16px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.8em;
        margin-bottom: 25px;
        letter-spacing: 0;
    }
}

.search-section {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .search-section {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 20px;
    }
}

#searchInput {
    flex: 1;
    padding: 18px 24px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: all 0.3s;
    background: var(--bg);
    color: var(--text);
}

@media (max-width: 768px) {
    #searchInput {
        padding: 14px 18px;
        font-size: 16px; /* Prevent zoom on iOS */
        border-radius: 10px;
    }
}

#searchInput:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

button {
    padding: 18px 32px;
    background: var(--primary);
    color: var(--accent);
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    button {
        padding: 14px 24px;
        font-size: 14px;
        border-radius: 10px;
        min-height: 44px; /* Better touch target */
        width: 100%;
    }
}

button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    background: var(--text-lighter);
    cursor: not-allowed;
    transform: none;
}

.search-results {
    margin-bottom: 30px;
    max-height: 500px;
    overflow-y: auto;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    display: none;
    background: var(--bg);
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .search-results {
        padding: 15px;
        border-radius: 10px;
        max-height: 400px;
        margin-bottom: 20px;
    }
}

.search-results.active {
    display: block;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-item {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.3s;
    border-radius: 8px;
    margin-bottom: 8px;
    -webkit-tap-highlight-color: transparent;
}

@media (max-width: 768px) {
    .result-item {
        padding: 15px;
        gap: 15px;
        margin-bottom: 10px;
    }
    
    .result-item:hover {
        transform: none; /* Disable hover transform on mobile */
    }
}

.result-item:hover {
    background: var(--bg-gray);
    transform: translateX(8px);
}

.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.result-item img {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .result-item img {
        width: 80px;
        height: 80px;
    }
}

.result-item-info h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 600;
}

@media (max-width: 768px) {
    .result-item-info h3 {
        font-size: 15px;
        margin-bottom: 6px;
    }
    
    .result-item-info p {
        font-size: 12px;
    }
}

.result-item-info p {
    font-size: 14px;
    color: var(--text-light);
}

.sku-text {
    font-family: 'Monaco', 'Menlo', monospace;
    color: var(--text-light);
    font-weight: 600;
    font-size: 13px;
}

.selected-items {
    margin-bottom: 30px;
}

.selected-items h2 {
    margin-bottom: 24px;
    color: var(--text);
    font-size: 24px;
    font-weight: 700;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .selected-items h2 {
        font-size: 18px;
        margin-bottom: 16px;
    }
}

.items-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
}

@media (max-width: 1100px) {
    .items-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .items-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

.selected-item-card {
    border: 2px solid var(--primary);
    border-radius: 16px;
    padding: 24px;
    background: var(--bg);
    position: relative;
    transition: all 0.3s;
    box-shadow: 0 2px 8px var(--shadow);
}

@media (max-width: 768px) {
    .selected-item-card {
        padding: 16px;
        border-radius: 12px;
    }
    
    .selected-item-card:hover {
        transform: none; /* Disable hover transform on mobile */
    }
}

.selected-item-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px var(--shadow-lg);
}

.selected-item-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

@media (max-width: 768px) {
    .selected-item-card img {
        height: 200px;
        margin-bottom: 12px;
    }
}

.selected-item-card h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 600;
    line-height: 1.4;
}

@media (max-width: 768px) {
    .selected-item-card h3 {
        font-size: 16px;
        margin-bottom: 6px;
    }
}

.item-sku {
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    color: var(--text-light);
    background: var(--bg-gray);
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    margin-bottom: 12px;
    font-weight: 600;
}

.item-note-box {
    margin: 0 0 12px 0;
}

.item-note-box label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.item-note-input {
    width: 100%;
    min-height: 66px;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.35;
    resize: vertical;
    outline: none;
    background: var(--bg);
    color: var(--text);
}

.item-note-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

.size-selector {
    margin-top: 12px;
}

.size-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.size-selector select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: all 0.3s;
}

.size-selector select:hover {
    border-color: var(--primary);
}

.size-selector select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

.size-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 28px;
}

.size-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #ff0000;
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.size-chip-remove {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0 2px;
    font-size: 14px;
    line-height: 1;
    opacity: 0.9;
    -webkit-tap-highlight-color: transparent;
}

.size-chip-remove:hover {
    opacity: 1;
}

.size-placeholder {
    color: var(--text-lighter);
    font-size: 13px;
}

.size-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.size-add-row .size-add-select {
    flex: 1;
    min-width: 140px;
}

.btn-add-size {
    padding: 10px 16px !important;
    font-size: 13px !important;
    white-space: nowrap;
}

.size-custom-row {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
}

.size-custom-row > label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.size-custom-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.custom-size-input {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    outline: none;
}

.custom-size-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05);
}

.btn-add-custom-size {
    padding: 10px 14px !important;
    font-size: 13px !important;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .size-custom-controls {
        flex-direction: column;
        align-items: stretch;
    }
    .custom-size-input {
        min-width: 0;
    }
    .size-add-row {
        flex-direction: column;
        align-items: stretch;
    }
    .size-add-row .size-add-select {
        min-width: 0;
    }
}

.remove-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--text);
    color: var(--accent);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 8px var(--shadow);
    -webkit-tap-highlight-color: transparent;
}

.remove-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

@media (max-width: 768px) {
    .remove-btn {
        width: 40px;
        height: 40px;
        top: 12px;
        right: 12px;
        font-size: 22px;
    }
    
    .remove-btn:hover {
        transform: scale(1.05);
    }
    
    .remove-btn:active {
        transform: scale(0.9);
    }
}

.email-section {
    margin-bottom: 30px;
    padding: 24px;
    background: var(--bg-gray);
    border-radius: 12px;
    border: 2px solid var(--border);
}

@media (max-width: 768px) {
    .email-section {
        padding: 16px;
        margin-bottom: 20px;
        border-radius: 10px;
    }
    
    .email-section h3 {
        font-size: 13px !important;
        margin-bottom: 10px !important;
    }
    
    .email-section > div {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .email-section input {
        width: 100% !important;
        padding: 14px !important;
        font-size: 16px !important; /* Prevent zoom on iOS */
    }
    
    .email-section button {
        width: 100% !important;
    }
}

.email-section h3 {
    margin-bottom: 15px;
    color: var(--text);
    font-weight: 700;
    text-transform: uppercase;
}

.actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .actions {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .actions button {
        width: 100%;
    }
}

#generateBtn {
    background: var(--primary);
    font-size: 18px;
    padding: 20px 48px;
}

@media (max-width: 768px) {
    #generateBtn {
        font-size: 16px;
        padding: 16px 32px;
    }
}

#generateBtn:hover:not(:disabled) {
    background: var(--primary-dark);
}

/* Modal Styles */
.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.5);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 30px;
    border: 2px solid #ddd;
    border-radius: 16px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 15px;
}

.close:hover,
.close:focus {
    color: #000;
}

@media (max-width: 768px) {
    .modal-content {
        margin: 10% auto;
        padding: 20px;
        width: 95%;
    }
}

.preview {
    text-align: center;
    display: none;
    animation: fadeIn 0.5s ease;
}

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

.preview.active {
    display: block;
}

.preview img {
    max-width: 100%;
    border-radius: 16px;
    box-shadow: 0 10px 40px var(--shadow-lg);
    margin-bottom: 24px;
    border: 2px solid var(--border);
}

.preview a.preview-btn,
.preview .preview-btn {
    display: inline-block;
    padding: 18px 36px;
    background: var(--primary);
    color: var(--accent);
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    margin-top: 12px;
    transition: all 0.3s;
    text-transform: uppercase;
}

.preview a.preview-btn:hover {
    transform: translateY(-2px);
    background: var(--primary-dark);
    box-shadow: 0 4px 12px var(--shadow);
}

.loading {
    text-align: center;
    padding: 30px;
    color: var(--text);
    font-weight: 600;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* Scrollbar styling */
.search-results::-webkit-scrollbar {
    width: 8px;
}

.search-results::-webkit-scrollbar-track {
    background: var(--bg-gray);
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* Additional mobile optimizations */
@media (max-width: 768px) {
    body {
        padding-left: 0;
        padding-right: 0;
        padding-bottom: 0;
    }
    
    .preview {
        padding: 10px;
    }
    
    .preview img {
        border-radius: 10px;
    }
    
    .preview a.preview-btn {
        padding: 14px 28px;
        font-size: 16px;
        display: block;
        margin: 10px 0;
    }
    .preview a.preview-image-link {
        display: block;
        padding: 0;
        margin: 0 auto 8px;
        background: transparent;
    }
    
    .size-selector select {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .loading {
        padding: 20px;
        font-size: 16px;
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .container {
        padding: 15px 10px;
    }
    
    h1 {
        font-size: 1.5em;
    }
    
    .result-item-info h3 {
        font-size: 14px;
    }
    
    .selected-item-card h3 {
        font-size: 15px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Mobile devices */
    button:active {
        transform: scale(0.98);
    }
    
    .result-item:active {
        background: var(--bg-gray);
        transform: scale(0.98);
    }
    
    .selected-item-card:active {
        transform: scale(0.98);
    }
}

/* Prevent text selection on buttons */
button, .result-item {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Better focus states for accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.5);
    outline-offset: 2px;
}

.top-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.lang-switch {
    display: flex;
    gap: 4px;
    background: var(--bg-gray);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px;
}

.lang-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background: transparent;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-light);
    min-height: 32px;
}

.lang-btn.active {
    background: #000;
    color: #fff;
}

.lang-btn:hover:not(.active) {
    background: var(--border);
}

.auth-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    background: var(--bg-gray);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.auth-user, .auth-guest {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.auth-email {
    font-weight: 600;
    color: var(--text);
}

.plan-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.plan-badge.pro {
    background: #000;
    color: #fff;
}

.plan-badge.free {
    background: #e0e0e0;
    color: #666;
}

.search-limit {
    font-size: 12px;
    color: var(--text-light);
}

.btn-primary, .btn-secondary, .btn-pro {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 13px;
    min-height: 44px;
}

.btn-primary {
    background: #000;
    color: #fff;
}

.btn-secondary {
    background: #666;
    color: #fff;
}

.btn-pro {
    background: linear-gradient(135deg, #000 0%, #333 100%);
    color: #fff;
}

.login-prompt {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.login-prompt h2 {
    font-size: 1.5em;
    margin-bottom: 12px;
    color: var(--text);
}

.plan-limit-banner {
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
    color: #5d4037;
}

.plan-limit-banner a {
    color: #000;
    font-weight: 700;
}

.pricing-modal {
    max-width: 700px !important;
}

.pricing-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 24px;
}

.pricing-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 600px) {
    .pricing-cards {
        grid-template-columns: 1fr;
    }
}

.pricing-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    position: relative;
}

.pricing-card.featured {
    border-color: #000;
}

.pricing-promo {
    font-size: 13px;
    color: #2e7d32;
    font-weight: 600;
    margin: 8px 0 12px;
}

.badge-trial {
    background: #2e7d32 !important;
}

.btn-featured {
    font-size: 14px;
    padding: 14px 20px;
}

/* .badge positioning is defined in theme.css (.ribbon / .badge) */

.pricing-card .price {
    font-size: 2.5em;
    font-weight: 800;
    margin: 16px 0;
}

.pricing-card .price span {
    font-size: 0.35em;
    font-weight: 600;
    color: var(--text-light);
}

.pricing-card ul {
    list-style: none;
    text-align: left;
    margin: 16px 0 24px;
    padding: 0;
}

.pricing-card li {
    padding: 6px 0;
    font-size: 14px;
}

.pricing-free-note {
    text-align: center;
    font-size: 13px;
    color: var(--text-light);
}

.auth-error {
    color: #ef4444;
    font-weight: 600;
}

