:root {
  --primary: #2D5F57; --primary-dark: #1E4038; --bg: #F9F7F4; --card-bg: #FFFFFF;
  --text: #2D5F57; --text-secondary: #8B9B96; --border: #E8E4DF;
  --danger: #E74C3C; --danger-light: #FADBD8; --success: #27AE60; --favorite: #F1C40F;
}
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Georgia', 'Times New Roman', serif; -webkit-tap-highlight-color: transparent; }
body { background-color: var(--bg); color: var(--text); min-height: 100vh; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* Header & Logo */
.header { display: flex; align-items: center; padding: 20px; background: var(--bg); position: sticky; top: 0; z-index: 100; }
.header-menu, .header-close { width: 44px; height: 44px; border: none; background: var(--bg); border: 1px solid var(--border); border-radius: 50%; color: var(--text); font-size: 20px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.logo { width: 44px; height: 44px; background: var(--primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: bold; color: white; margin: 0 12px; }
.logo-text { font-size: 24px; font-weight: 400; color: var(--text); }
.header-spacer { flex: 1; }
.header-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--primary); border: none; color: white; font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

/* Sidebar */
.sidebar { position: fixed; top: 0; left: -100%; width: 85%; max-width: 400px; height: 100vh; background: var(--card-bg); z-index: 1000; transition: left 0.3s ease; box-shadow: 2px 0 20px rgba(0,0,0,0.15); display: flex; flex-direction: column; }
.sidebar.open { left: 0; }
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 999; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.sidebar-overlay.open { opacity: 1; pointer-events: all; }
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.sidebar-content { flex: 1; overflow-y: auto; padding: 20px; }
.sidebar-menu-item { padding: 15px; border-radius: 12px; margin-bottom: 10px; cursor: pointer; transition: background 0.2s; font-family: -apple-system, sans-serif; font-size: 16px; }
.sidebar-menu-item:active { background: var(--bg); }
.sidebar-footer { padding: 20px; border-top: 1px solid var(--border); text-align: center; color: var(--text-secondary); font-size: 14px; }

/* Container & Cards */
.container { flex: 1; padding: 20px; max-width: 600px; margin: 0 auto; width: 100%; }
.option-card { background: var(--card-bg); border-radius: 20px; padding: 25px; margin-bottom: 15px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); cursor: pointer; border: 1px solid var(--border); }
.option-card:active { transform: scale(0.98); }
.option-card h2 { font-size: 22px; font-weight: 400; margin-bottom: 8px; color: var(--text); }
.option-card p { font-size: 14px; color: var(--text-secondary); font-family: -apple-system, sans-serif; }

/* Wallet View (Stacked) - CORRIGÉ POUR VOIR LES ENSEIGNES */
.wallet-view { position: relative; height: 280px; margin-bottom: 20px; }
.wallet-card { position: absolute; width: 100%; border-radius: 20px; padding: 25px 25px 15px 25px; color: white; box-shadow: 0 4px 12px rgba(0,0,0,0.25); cursor: pointer; transition: transform 0.3s; min-height: 160px; left: 0; display: flex; flex-direction: column; justify-content: flex-start; }
.wallet-card[data-index="0"] { top: 0; z-index: 1; }
.wallet-card[data-index="1"] { top: 35px; z-index: 2; }
.wallet-card[data-index="2"] { top: 70px; z-index: 3; }
.wallet-card:active { transform: scale(0.98); }
.loyalty-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.loyalty-card-store { font-size: 24px; font-weight: 400; text-shadow: 0 1px 3px rgba(0,0,0,0.3); } /* CONTRASTE AMÉLIORÉ */
.loyalty-card-holder { font-size: 13px; opacity: 0.9; margin-top: 5px; font-family: -apple-system, sans-serif; text-transform: uppercase; letter-spacing: 1px; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.loyalty-card-badge { background: rgba(255,255,255,0.3); padding: 6px 12px; border-radius: 12px; font-size: 11px; font-weight: 600; text-transform: uppercase; font-family: -apple-system, sans-serif; backdrop-filter: blur(4px); }

/* List View */
.loyalty-card { border-radius: 20px; padding: 25px; margin-bottom: 15px; color: white; position: relative; box-shadow: 0 4px 12px rgba(0,0,0,0.15); cursor: pointer; min-height: 140px; display: flex; flex-direction: column; justify-content: space-between; }
.loyalty-card:active { transform: scale(0.98); }
.loyalty-card-number { font-size: 18px; font-family: 'Courier New', monospace; letter-spacing: 2px; opacity: 0.95; margin-top: 15px; }
.favorite-star { position: absolute; top: 20px; right: 20px; font-size: 24px; color: rgba(255,255,255,0.4); cursor: pointer; z-index: 10; }
.favorite-star.active { color: var(--favorite); text-shadow: 0 0 5px rgba(241, 196, 15, 0.5); }

/* Couleurs déterministes (seront assignées par JS) */
.loyalty-card-red { background: linear-gradient(135deg, #E74C3C 0%, #C0392B 100%); }
.loyalty-card-green { background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%); }
.loyalty-card-blue { background: linear-gradient(135deg, #3498DB 0%, #2980B9 100%); }
.loyalty-card-purple { background: linear-gradient(135deg, #9B59B6 0%, #8E44AD 100%); }

/* Forms */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin-bottom: 8px; font-family: -apple-system, sans-serif; }
.form-input, .form-textarea { width: 100%; padding: 16px; border: 1px solid var(--border); border-radius: 12px; font-size: 16px; background: var(--card-bg); color: var(--text); outline: none; font-family: -apple-system, sans-serif; }
.form-textarea { min-height: 100px; resize: vertical; }
.form-input:focus, .form-textarea:focus { border-color: var(--primary); }
.search-container { position: relative; margin-bottom: 20px; }
.search-clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-secondary); font-size: 20px; cursor: pointer; padding: 5px; }

/* Buttons */
.btn { width: 100%; padding: 18px; border: none; border-radius: 14px; font-size: 17px; font-weight: 600; cursor: pointer; margin-bottom: 10px; font-family: -apple-system, sans-serif; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: #2563EB; color: white; }
.btn-secondary { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); }
.btn-danger-light { background: var(--danger-light); color: var(--danger); }
.btn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* Toggle */
.toggle-group { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--border); }
.toggle-info { flex: 1; padding-right: 15px; }
.toggle-info h3 { font-size: 17px; font-weight: 600; margin-bottom: 5px; font-family: -apple-system, sans-serif; }
.toggle-info p { font-size: 13px; color: var(--text-secondary); font-family: -apple-system, sans-serif; line-height: 1.4; }
.toggle { width: 51px; height: 31px; background: var(--border); border-radius: 20px; position: relative; cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.toggle.active { background: var(--success); }
.toggle::after { content: ''; position: absolute; width: 27px; height: 27px; background: white; border-radius: 50%; top: 2px; left: 2px; transition: transform 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.toggle.active::after { transform: translateX(20px); }

/* Mode Switch */
.mode-switch { display: flex; background: var(--bg); border-radius: 12px; padding: 4px; margin-bottom: 25px; }
.mode-option { flex: 1; padding: 12px; text-align: center; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 15px; transition: all 0.2s; font-family: -apple-system, sans-serif; }
.mode-option.active { background: var(--card-bg); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,0.08); border: 1px solid var(--border); }
.mode-option:not(.active) { color: var(--text-secondary); border: 1px solid transparent; }

/* Card Detail */
.card-detail { background: var(--card-bg); border-radius: 20px; padding: 30px; margin-bottom: 20px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
.card-detail-header { text-align: center; margin-bottom: 20px; }
.card-detail-store { font-size: 24px; font-weight: 400; color: var(--text); margin-bottom: 5px; }
.card-detail-number { font-size: 16px; color: var(--text-secondary); font-family: 'Courier New', monospace; }
.barcode-container { background: white; border-radius: 16px; padding: 30px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 250px; margin-bottom: 20px; }
.barcode-container svg, .barcode-container canvas { max-width: 100%; height: auto; }
.brightness-control { background: var(--primary-dark); color: white; border-radius: 12px; padding: 15px 20px; margin-bottom: 15px; }
.brightness-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-family: -apple-system, sans-serif; font-size: 15px; font-weight: 600; }
.brightness-slider { width: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,0.3); outline: none; -webkit-appearance: none; }
.brightness-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: white; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }

/* Tags */
.tags-display { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; background: var(--bg); border-radius: 12px; min-height: 50px; align-items: center; margin-bottom: 8px; }
.tag { background: var(--primary); color: white; padding: 6px 12px; border-radius: 16px; font-size: 13px; font-family: -apple-system, sans-serif; display: flex; align-items: center; gap: 6px; }
.tag-remove { cursor: pointer; font-weight: bold; font-size: 16px; line-height: 1; }
.tags-suggestions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag-suggestion { background: var(--border); color: var(--text); padding: 6px 12px; border-radius: 12px; font-size: 13px; cursor: pointer; font-family: -apple-system, sans-serif; transition: background 0.2s; }
.tag-suggestion:active { background: var(--primary); color: white; }

/* Toast & Footer */
#toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,0.85); color: white; padding: 12px 24px; border-radius: 24px; font-size: 14px; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 3000; font-family: -apple-system, sans-serif; }
#toast.show { opacity: 1; }
.footer { text-align: center; padding: 30px 20px; color: var(--text-secondary); font-size: 14px; font-family: -apple-system, sans-serif; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary); margin: 25px 0 15px; font-family: -apple-system, sans-serif; font-weight: 600; }
.wallet-id-box { background: var(--bg); border: 2px dashed var(--border); border-radius: 12px; padding: 15px; text-align: center; font-family: 'Courier New', monospace; font-size: 14px; word-break: break-all; margin-bottom: 15px; }

/* Guests & Invitations */
.guest-item { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 15px; margin-bottom: 10px; }
.guest-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; flex-wrap: wrap; gap: 10px; }
.guest-email { font-weight: 600; font-family: -apple-system, sans-serif; }
.guest-status { font-size: 12px; padding: 4px 8px; border-radius: 8px; background: var(--success); color: white; }
.guest-status.pending { background: var(--text-secondary); }
.guest-actions { display: flex; gap: 10px; margin-top: 10px; }
.btn-small { padding: 8px 12px; font-size: 13px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); cursor: pointer; font-family: -apple-system, sans-serif; }
.btn-small:active { background: var(--border); }

/* Keyword Management */
.keyword-manage-item { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.keyword-manage-item:last-child { border-bottom: none; }
.keyword-name { font-family: -apple-system, sans-serif; font-weight: 500; }
.keyword-actions { display: flex; gap: 8px; }
