/* ============================================================
   ROTI VOTE — Frontend Styles v1.2
   ============================================================ */

/* ---- Home Wrapper ---- */
.roti-home-wrapper {
    max-width: 780px;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---- Bloc Rejoindre ---- */
.roti-join-box {
    background: #f0f6fc;
    border: 1px solid #c3c4c7;
    border-left: 4px solid #3b82f6;
    border-radius: 10px;
    padding: 22px 26px;
    margin-bottom: 20px;
}
.roti-join-box h3 { margin: 0 0 16px 0; font-size: 17px; font-weight: 700; color: #1e293b; }

.roti-join-form { display: flex; align-items: center; gap: 12px; }

.roti-join-form #roti-join-code {
    text-transform: uppercase; letter-spacing: 4px; font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace; font-size: 18px;
    width: 220px; text-align: center; padding: 12px 16px;
    border: 2px solid #94a3b8; border-radius: 10px; background: #fff;
    transition: border-color 0.2s;
}
.roti-join-form #roti-join-code::placeholder {
    font-size: 13px; letter-spacing: 0.5px; font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    text-transform: none;
}
.roti-join-form #roti-join-code:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }

.roti-join-form #roti-join-name {
    flex: 1; min-width: 160px; padding: 12px 16px;
    border: 2px solid #d1d5db; border-radius: 10px; font-size: 15px;
    background: #fff; transition: border-color 0.2s;
}
.roti-join-form #roti-join-name:focus { border-color: #3b82f6; outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }

.roti-join-error { color: #dc2626; margin-top: 10px; font-size: 13px; font-weight: 500; }

/* ---- Boutons ---- */
.roti-btn {
    padding: 12px 24px; border: none; border-radius: 10px;
    font-size: 15px; font-weight: 600; cursor: pointer;
    transition: all 0.2s ease; white-space: nowrap;
}
.roti-btn:hover { transform: translateY(-1px); }

.roti-btn-join { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }
.roti-btn-join:hover { box-shadow: 0 4px 12px rgba(37,99,235,0.3); }

.roti-btn-create { background: linear-gradient(135deg, #22c55e, #16a34a); color: #fff; width: 100%; margin-top: 10px; }
.roti-btn-create:hover { box-shadow: 0 4px 12px rgba(22,163,74,0.3); }

.roti-btn-new { background: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }
.roti-btn-new:hover { background: #e2e8f0; }

.roti-btn-export { background: linear-gradient(135deg, #1e293b, #334155); color: #fff; }
.roti-btn-export:hover { box-shadow: 0 4px 12px rgba(30,41,59,0.3); }

/* ---- Bloc Creer ---- */
.roti-create-box {
    background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
    padding: 24px 28px; margin-bottom: 20px; box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.roti-create-box h3 { margin: 0 0 18px 0; font-size: 17px; font-weight: 700; color: #1e293b; }

.roti-create-fields { display: flex; flex-direction: column; gap: 12px; }
.roti-create-fields .roti-input {
    width: 100%; padding: 12px 16px; border: 2px solid #d1d5db;
    border-radius: 10px; font-size: 15px; box-sizing: border-box; transition: border-color 0.2s;
}
.roti-create-fields .roti-input:focus { border-color: #22c55e; outline: none; box-shadow: 0 0 0 3px rgba(34,197,94,0.15); }

.roti-checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #475569; cursor: pointer; }
.roti-checkbox-label input[type="checkbox"] { width: 18px; height: 18px; accent-color: #22c55e; }

/* ---- QR Code (SVG) ---- */
.roti-qr-svg-container {
    display: inline-block; border: 3px solid #e2e8f0; border-radius: 12px;
    padding: 10px; background: #fff; transition: transform 0.15s, box-shadow 0.15s; line-height: 0;
}
.roti-qr-svg-container svg { display: block; width: 200px; height: 200px; }
.roti-qr-label { display: block; font-size: 11px; color: #94a3b8; margin-top: 4px; text-align: center; }

.roti-code-display-big {
    background: #eff6ff; color: #2563eb; padding: 8px 16px; border-radius: 8px;
    font-size: 22px; font-weight: 700; letter-spacing: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace; cursor: pointer;
}

/* ============================================================
   CREATOR DASHBOARD
   ============================================================ */

.roti-creator-wrap {
    max-width: 700px; margin: 0 auto;
}

.roti-creator-header {
    display: flex; align-items: flex-start; gap: 24px;
    background: #fff; border-radius: 14px; padding: 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,0.07); margin-bottom: 20px; flex-wrap: wrap;
}
.roti-creator-header-info { flex: 1; min-width: 240px; }
.roti-creator-header-info h2 { margin: 0 0 10px 0; font-size: 22px; color: #1e293b; }
.roti-creator-code { font-size: 14px; color: #64748b; }

.roti-creator-qr { text-align: center; flex-shrink: 0; }

.roti-creator-stats {
    display: flex; gap: 16px; margin-bottom: 20px;
}
.roti-creator-stat-card {
    flex: 1; background: #fff; border-radius: 12px; padding: 20px;
    text-align: center; box-shadow: 0 2px 10px rgba(0,0,0,0.06);
    border-top: 4px solid #3b82f6;
}
.roti-creator-stat-card:last-child { border-top-color: #22c55e; }
.roti-stat-number { display: block; font-size: 36px; font-weight: 800; color: #1e293b; line-height: 1.2; }
.roti-stat-label { display: block; font-size: 13px; color: #64748b; margin-top: 4px; }

.roti-creator-section {
    background: #fff; border-radius: 12px; padding: 20px 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06); margin-bottom: 16px;
}
.roti-creator-section h3 {
    margin: 0 0 14px 0; font-size: 16px; font-weight: 700; color: #1e293b;
    display: flex; align-items: center; gap: 8px;
}

.roti-participant-count {
    background: #dbeafe; color: #1d4ed8; padding: 2px 10px;
    border-radius: 20px; font-size: 13px; font-weight: 600;
}

.roti-waiting { text-align: center; color: #94a3b8; font-style: italic; padding: 20px 0; }

/* Participants list */
.roti-participants-list { display: flex; flex-direction: column; gap: 8px; }
.roti-participant-row {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    background: #f8fafc; border-radius: 10px; border: 1px solid #e2e8f0;
    transition: background 0.15s;
}
.roti-participant-row:hover { background: #eff6ff; }
.roti-p-name { font-weight: 600; color: #1e293b; min-width: 120px; }
.roti-p-vote { font-size: 15px; min-width: 80px; }
.roti-p-comment { flex: 1; font-size: 13px; color: #64748b; font-style: italic; }

.roti-creator-actions { display: flex; gap: 12px; justify-content: center; margin-top: 4px; }

/* ============================================================
   VOTE FORM
   ============================================================ */

.roti-vote-container, .roti-create-container {
    max-width: 640px; margin: 30px auto; padding: 30px;
    background: #fff; border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.roti-title { text-align: center; font-size: 24px; color: #1e293b; margin: 0 0 6px 0; }
.roti-subtitle { text-align: center; color: #64748b; font-size: 15px; margin: 0 0 6px 0; }
.roti-code-info { text-align: center; color: #94a3b8; font-size: 13px; margin-bottom: 24px; }
.roti-code-info strong { color: #3b82f6; letter-spacing: 2px; font-family: monospace; }

/* Emoji row */
.roti-emoji-row { display: flex; justify-content: center; gap: 10px; margin-bottom: 24px; flex-wrap: nowrap; }
.roti-emoji-btn {
    display: flex; flex-direction: column; align-items: center; gap: 6px;
    padding: 16px 8px; border: 2px solid #e2e8f0; border-radius: 14px;
    background: #fff; cursor: pointer; transition: all 0.25s ease;
    flex: 1 1 0; max-width: 140px;
}
.roti-emoji-btn:hover { border-color: #3b82f6; transform: translateY(-4px); box-shadow: 0 6px 20px rgba(59,130,246,0.15); }
.roti-emoji-btn.selected { border-color: #3b82f6; background: #eff6ff; transform: translateY(-4px); box-shadow: 0 6px 20px rgba(59,130,246,0.2); }
.roti-emoji-icon { font-size: 56px; line-height: 1; }
.roti-emoji-score { font-size: 15px; font-weight: 700; color: #1e293b; }
.roti-emoji-label { font-size: 12px; color: #94a3b8; text-align: center; }

/* Fields */
.roti-fields { margin-bottom: 20px; }
.roti-field-group { margin-bottom: 14px; }
.roti-field-group label { display: block; font-size: 14px; font-weight: 500; color: #374151; margin-bottom: 4px; }
.roti-input {
    width: 100%; padding: 10px 14px; border: 1px solid #d1d5db;
    border-radius: 10px; font-size: 14px; transition: border-color 0.2s ease; box-sizing: border-box;
}
.roti-input:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,0.1); }

/* Submit */
.roti-submit-btn {
    display: block; width: 100%; padding: 14px;
    background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff;
    font-size: 16px; font-weight: 600; border: none; border-radius: 12px;
    cursor: pointer; transition: all 0.2s ease;
}
.roti-submit-btn:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,0.3); }
.roti-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Thank you / Already voted */
.roti-thank-you, .roti-already-voted { text-align: center; padding: 30px 20px; }
.roti-check-icon { font-size: 48px; margin-bottom: 10px; }
.roti-thank-you p, .roti-already-voted p { font-size: 18px; color: #1e293b; font-weight: 500; }

/* Results */
.roti-results-box { margin-top: 24px; padding: 20px; background: #f8fafc; border-radius: 12px; }
.roti-results-summary { display: flex; justify-content: center; gap: 24px; margin-bottom: 20px; }
.roti-results-avg { font-size: 32px; font-weight: 800; color: #16a34a; }
.roti-results-count { font-size: 14px; color: #64748b; display: flex; align-items: center; }
.roti-results-bars { max-width: 500px; margin: 0 auto; }
.roti-res-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.roti-res-emoji { font-size: 28px; width: 40px; text-align: center; }
.roti-res-emoji img { width: 36px; height: 36px; object-fit: contain; }
.roti-res-bar-bg { flex: 1; background: #e2e8f0; border-radius: 6px; height: 28px; overflow: hidden; }
.roti-res-bar {
    height: 100%; border-radius: 6px; color: #fff; font-size: 11px; font-weight: 600;
    display: flex; align-items: center; justify-content: center;
    min-width: 2px; transition: width 0.6s ease;
}
.roti-res-num { width: 30px; text-align: right; font-size: 13px; color: #64748b; font-weight: 600; }

/* Misc */
.roti-error { text-align: center; padding: 30px; color: #dc2626; font-size: 16px; background: #fef2f2; border-radius: 12px; }
.roti-no-results { text-align: center; color: #94a3b8; }

/* Copy icon */
.roti-copy-icon {
    cursor: pointer; margin-left: 8px; font-size: 16px;
    opacity: 0.5; transition: opacity 0.2s; display: inline-block;
    vertical-align: middle;
}
.roti-copy-icon:hover { opacity: 1; }
.roti-code-copyable { cursor: pointer; }
.roti-code-copyable:hover { color: #2563eb; }

/* QR clickable */
.roti-qr-clickable { cursor: pointer; transition: transform 0.2s; }
.roti-qr-clickable:hover { transform: scale(1.05); }
.roti-btn-qr-fullscreen {
    display: block; margin: 8px auto 0; padding: 6px 16px;
    background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 8px;
    font-size: 13px; color: #475569; cursor: pointer; transition: all 0.2s;
}
.roti-btn-qr-fullscreen:hover { background: #e2e8f0; color: #1e293b; }

/* QR Fullscreen overlay */
.roti-qr-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85); z-index: 999999;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.roti-qr-overlay-content {
    background: #fff; border-radius: 24px; padding: 48px;
    text-align: center; cursor: default;
    max-width: 90vw; max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.roti-qr-overlay-svg svg { width: 400px; height: 400px; }
.roti-qr-overlay-code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 48px; font-weight: 800; letter-spacing: 10px;
    color: #2563eb; margin: 20px 0 4px;
}
.roti-qr-overlay-hint { color: #64748b; font-size: 16px; margin: 0 0 24px; }
.roti-qr-overlay-close {
    padding: 10px 32px; font-size: 15px; border-radius: 10px;
}

/* Custom welcome text */
.roti-welcome-text {
    text-align: center; padding: 16px 24px; margin-bottom: 20px;
    background: linear-gradient(135deg, #eff6ff, #f0fdf4);
    border-radius: 12px; border: 1px solid #c3dafe;
    color: #1e293b; font-size: 15px; line-height: 1.6;
}

/* Creator vote toggle */
.roti-creator-vote-section {
    background: #fff; border-radius: 12px; padding: 20px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06); margin-bottom: 20px;
}
.roti-toggle-row { display: flex; align-items: center; }
.roti-toggle-label {
    display: flex; align-items: center; gap: 12px;
    font-size: 15px; color: #374151; cursor: pointer; font-weight: 500;
}
.roti-toggle-switch {
    position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0;
}
.roti-toggle-switch input { opacity: 0; width: 0; height: 0; }
.roti-toggle-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: #cbd5e1; border-radius: 26px; transition: 0.3s;
}
.roti-toggle-slider::before {
    content: ""; position: absolute; height: 20px; width: 20px;
    left: 3px; bottom: 3px; background: #fff; border-radius: 50%;
    transition: 0.3s; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.roti-toggle-switch input:checked + .roti-toggle-slider { background: #22c55e; }
.roti-toggle-switch input:checked + .roti-toggle-slider::before { transform: translateX(22px); }
.roti-creator-vote-form { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e2e8f0; }
.roti-creator-vote-thanks {
    text-align: center; padding: 16px; font-size: 16px; font-weight: 500; color: #16a34a;
}

/* ============================================================
   ICON SET PICKER
   ============================================================ */

.roti-iconset-picker { margin-top: 16px; }
.roti-iconset-title { font-size: 14px; font-weight: 600; color: #374151; margin: 0 0 10px 0; }
.roti-iconset-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }

.roti-iconset-option {
    cursor: pointer; display: block;
}
.roti-iconset-option input[type="radio"] { display: none; }

.roti-iconset-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    padding: 18px 22px; border: 2px solid #e2e8f0; border-radius: 12px;
    background: #f8fafc; transition: border-color 0.2s ease, background 0.2s ease; height: 100%; box-sizing: border-box;
}
.roti-iconset-option:hover .roti-iconset-card { border-color: #94a3b8; background: #fff; }
.roti-iconset-option.selected .roti-iconset-card {
    border-color: #22c55e; background: #f0fdf4; outline: 3px solid rgba(34,197,94,0.3); outline-offset: -1px;
}

.roti-iconset-preview { display: flex; gap: 10px; justify-content: center; align-items: center; }
.roti-iconset-icon { font-size: 44px; line-height: 1; }
.roti-iconset-icon img { width: 44px; height: 44px; object-fit: contain; }
.roti-iconset-name { font-size: 13px; color: #64748b; font-weight: 500; }
.roti-emoji-icon img { width: 72px; height: 72px; object-fit: contain; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
    .roti-home-wrapper { margin: 10px; }
    .roti-join-box { padding: 16px; }
    .roti-join-form { flex-direction: column; }
    .roti-join-form #roti-join-code, .roti-join-form #roti-join-name, .roti-btn-join { width: 100%; max-width: none; }
    .roti-join-form #roti-join-code { text-align: center; }
    .roti-create-box { padding: 16px; }
    .roti-creator-header { flex-direction: column; align-items: center; text-align: center; }
    .roti-creator-stats { flex-direction: column; }
    .roti-creator-actions { flex-direction: column; }
    .roti-creator-actions .roti-btn { width: 100%; text-align: center; }
    .roti-participant-row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .roti-vote-container, .roti-create-container { margin: 15px; padding: 20px; }
    .roti-emoji-row { gap: 6px; }
    .roti-emoji-btn { padding: 10px 4px; }
    .roti-emoji-icon { font-size: 36px; }
    .roti-emoji-icon img { width: 44px; height: 44px; }
    .roti-emoji-score { font-size: 11px; }
    .roti-emoji-label { display: none; }
    .roti-iconset-icon { font-size: 32px; }
    .roti-iconset-icon img { width: 32px; height: 32px; }
    .roti-iconset-options { grid-template-columns: 1fr; gap: 8px; }
    .roti-qr-svg-container svg { width: 160px; height: 160px; }
    .roti-qr-overlay-content { padding: 28px; }
    .roti-qr-overlay-svg svg { width: 280px; height: 280px; }
    .roti-qr-overlay-code { font-size: 32px; letter-spacing: 6px; }
}
