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

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

.hidden { display: none !important; }

/* ===== Auth ===== */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-card h1 {
    text-align: center;
    font-size: 2rem;
    margin-bottom: 8px;
}

.tagline {
    text-align: center;
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: #f0f0f0;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.tab.active {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.auth-form {
    display: flex;
    flex-direction: row;
    gap: 12px;
}

.auth-form input, .auth-form select {
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.auth-form input:focus, .auth-form select:focus {
    outline: none;
    border-color: #667eea;
}

.delivery-label {
    font-size: 0.85rem;
    color: #666;
    margin-top: 4px;
}

.btn-primary {
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover { background: #5568d3; }

.message {
    text-align: center;
    margin-top: 12px;
    font-size: 0.9rem;
    min-height: 20px;
}

.message.error { color: #e74c3c; }
.message.success { color: #27ae60; }

/* ===== App pages ===== */
.app-page {
    background: #f5f6fa;
}

.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 0;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header-content {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 { font-size: 1.4rem; }

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-email { font-size: 0.85rem; opacity: 0.9; }

.btn-logout {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-logout:hover { background: rgba(255,255,255,0.3); }

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 30px 20px;
}

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title-row h2 { color: #333; }

.btn-new-basket { width: auto; padding: 10px 20px; }

.btn-secondary {
    padding: 10px 20px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn-secondary:hover { background: #d0d0d0; }

.new-basket-form {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.new-basket-form input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.new-basket-form .btn-primary { width: auto; padding: 10px 24px; }

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

.basket-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
}

.basket-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.basket-card h3 {
    margin-bottom: 8px;
    color: #333;
}

.basket-card .basket-meta {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 16px;
}

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

.btn-small {
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-open { background: #667eea; color: white; flex: 1; }
.btn-open:hover { background: #5568d3; }

.btn-delete { background: #fdecea; color: #e74c3c; }
.btn-delete:hover { background: #fadbd8; }

.loading, .empty-state {
    color: #888;
    text-align: center;
    grid-column: 1 / -1;
    padding: 40px;
}

/* ===== Basket detail ===== */
.back-link {
    color: white;
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.9;
}

.back-link:hover { opacity: 1; text-decoration: underline; }

.basket-title { color: #333; margin-bottom: 24px; }

.search-section, .items-section, .compare-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.search-section h3, .items-section h3, .compare-section h3 {
    margin-bottom: 14px;
    color: #444;
    font-size: 1.05rem;
}

.search-wrapper { position: relative; }

#product-search {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

#product-search:focus { outline: none; border-color: #667eea; }

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    max-height: 320px;
    overflow-y: auto;
    z-index: 10;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item:hover { background: #f5f6ff; }

.search-result-item img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
}

.result-info { flex: 1; }
.result-brand { font-size: 0.78rem; color: #888; text-transform: uppercase; }
.result-name { font-size: 0.95rem; color: #333; }
.result-weight { font-size: 0.8rem; color: #999; }

.basket-items { display: flex; flex-direction: row; gap: 10px; }

.basket-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px;
    border: 1px solid #eee;
    border-radius: 10px;
}

.basket-item img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 8px;
    background: #f0f0f0;
}

.item-info { flex: 1; }
.item-brand { font-size: 0.78rem; color: #888; text-transform: uppercase; }
.item-name { color: #333; }
.item-qty { font-size: 0.9rem; color: #666; }

.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th, .comparison-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

.comparison-table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: #888;
    font-weight: 600;
}

.comparison-table .best-row {
    background: #f0fdf4;
}

.comparison-table .best-row td:first-child::before {
    content: "🏆 ";
}

.price-total { font-weight: 700; color: #333; }
.free-shipping { color: #27ae60; font-size: 0.85rem; }

.qty-controls { display: flex; align-items: center; gap: 8px; }
.btn-qty {
    width: 28px; height: 28px;
    border: 1px solid #ddd; background: white;
    border-radius: 6px; cursor: pointer; font-size: 1rem;
}
.btn-qty:hover:not(:disabled) { background: #f0f0ff; border-color: #667eea; }
.btn-qty:disabled { opacity: 0.3; cursor: default; }
.qty-value { min-width: 20px; text-align: center; font-weight: 600; }
.btn-remove {
    border: none; background: none; cursor: pointer;
    font-size: 1.1rem; opacity: 0.6; margin-left: 8px;
}
.btn-remove:hover { opacity: 1; }

/* ===== Alertes ===== */
.alert-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.alert-section h3 { margin-bottom: 14px; color: #444; font-size: 1.05rem; }

.alert-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.alert-input {
    width: 120px;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
}

.alert-input:focus { outline: none; border-color: #667eea; }

.alert-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.alert-status.reached { background: #d4f7dc; color: #1e8e3e; }
.alert-status.waiting { background: #fef3e0; color: #b06000; }

.btn-alert-delete {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 0.85rem;
    text-decoration: underline;
}

.alert-hint { font-size: 0.82rem; color: #999; margin-top: 10px; }

.basket-alert {
    font-size: 0.85rem;
    margin-bottom: 14px;
    padding: 6px 10px;
    border-radius: 8px;
    display: inline-block;
}
.basket-alert.none { color: #aaa; background: #f5f5f5; }
.basket-alert.reached { color: #1e8e3e; background: #d4f7dc; font-weight: 600; }
.basket-alert.waiting { color: #b06000; background: #fef3e0; }

/* ===== Fond line art page accueil ===== */
@import url('https://fonts.googleapis.com/css2?family=Caveat:wght@600&display=swap');

body:has(.auth-container) {
    background: #f4f2fc url('fond-lineart.svg') center / cover no-repeat;
}

.auth-container {
    flex-direction: row;
    gap: 24px;
}

.slogan {
    font-family: 'Caveat', cursive;
    font-size: 2.2rem;
    color: #6b5fc7;
    text-align: center;
    margin: 0;
    text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}

.logo-nav {
    height: 40px;
    width: auto;
    vertical-align: middle;
    margin-right: 8px;
    border-radius: 6px;
}

.auth-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 32px;
}

.auth-container .slogan {
    width: 100%;
    flex-basis: 100%;
}

.intro-card {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 16px;
    padding: 32px;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.intro-card h2 {
    margin: 0 0 16px 0;
    font-size: 1.4rem;
    color: #333;
}

.intro-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px 0;
}

.intro-list li {
    margin-bottom: 12px;
    line-height: 1.5;
    color: #444;
}

.intro-free {
    font-weight: 600;
    color: #6b5fc7;
    margin: 0;
}

@media (max-width: 900px) {
    .intro-card {
        max-width: 100%;
    }
}

.auth-form {
    flex-direction: column;
}

.auth-container {
    align-content: center;
}

.badge-best {
    background: #2ecc71;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    vertical-align: middle;
}

.savings-note {
    margin: 12px 0 0 0;
    font-weight: 600;
    color: #27ae60;
}

.search-hint {
    margin: 6px 0 0 4px;
    font-size: 0.85rem;
    color: #999;
}

.row-incomplete {
    opacity: 0.5;
}

.incomplete-note {
    font-size: 0.75rem;
    color: #b03a3a;
    font-style: italic;
    margin-left: 6px;
}

.promo-old {
    text-decoration: line-through;
    color: #999;
    font-weight: 400;
    font-size: 0.85rem;
}

.badge-promo {
    background: #e67e22;
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    cursor: help;
}
