/* Resto Calendar — Mobile-First Styles */

:root {
    --primary: #e74c3c;
    --primary-dark: #c0392b;
    --secondary: #2c3e50;
    --accent: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --bg: #f8f9fa;
    --card: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #e0e0e0;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --max-width: 480px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* App Container */
.app-container {
    max-width: var(--max-width);
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
    position: relative;
}

/* Auth Pages */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-logo {
    font-size: 48px;
    margin-bottom: 8px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-light);
    margin-bottom: 32px;
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
    width: 100%;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: 15px;
    background: var(--card);
    color: var(--text);
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
}

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237f8c8d' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:active {
    background: var(--primary-dark);
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
    width: auto;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Cards */
.card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-scheduled { background: #e8f4fd; color: #2980b9; }
.badge-confirmed { background: #e8f8f5; color: #27ae60; }
.badge-completed { background: #f0f3f4; color: #7f8c8d; }
.badge-cancelled { background: #fdedec; color: #e74c3c; }
.badge-pending { background: #fef9e7; color: #f39c12; }
.badge-paid { background: #e8f8f5; color: #27ae60; }
.badge-draft { background: #fef9e7; color: #f39c12; }
.badge-published { background: #e8f8f5; color: #27ae60; }

/* Top Navigation */
.top-nav {
    background: var(--card);
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-title {
    font-size: 18px;
    font-weight: 700;
}

.nav-user {
    font-size: 13px;
    color: var(--text-light);
}

.nav-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    color: var(--text);
}

.lang-btn {
    font-size: 13px !important;
    font-weight: 700;
    padding: 2px 6px !important;
    border: 1px solid var(--text-light) !important;
    border-radius: 4px;
    margin-right: 4px;
    line-height: 1.4;
}

/* Bottom Tab Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: var(--max-width);
    width: 100%;
    background: var(--card);
    display: flex;
    box-shadow: 0 -1px 4px rgba(0,0,0,0.06);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 0 6px;
    font-size: 10px;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.tab-item.active {
    color: var(--primary);
}

.tab-icon {
    font-size: 20px;
    margin-bottom: 2px;
}

/* Content Area */
.content {
    padding: 16px;
    padding-bottom: 72px;
}

/* Calendar View */
.calendar-list {
    list-style: none;
}

.calendar-item {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: var(--card);
    border-radius: var(--radius);
    margin-bottom: 10px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: transform 0.15s;
}

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

.calendar-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 48px;
}

.date-day {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.date-month {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
}

.calendar-info {
    flex: 1;
    min-width: 0;
}

.calendar-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.calendar-info p {
    font-size: 13px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-time {
    display: flex;
    align-items: center;
    color: var(--text-light);
    font-size: 13px;
}

/* Modal / Detail Sheet */
.detail-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    max-width: var(--max-width);
    width: 100%;
    background: var(--card);
    border-radius: 16px 16px 0 0;
    padding: 20px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    z-index: 200;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(100%); }
    to { transform: translateX(-50%) translateY(0); }
}

.detail-handle {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 4px;
    margin: 0 auto 16px;
}

.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    animation: fadeIn 0.2s;
}

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

/* Secret display for admin */
.hidden { display: none !important; }

/* Page-specific sections */
.page-section { display: none; }
.page-section.active { display: block; }

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
}

.stat-label {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* Filter tabs */
.filter-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.filter-tab {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: var(--card);
    border: 1px solid var(--border);
    cursor: pointer;
    white-space: nowrap;
    color: var(--text-light);
}

.filter-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px;
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeIn 0.2s;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

/* Toast */
.toast {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    max-width: var(--max-width);
    width: calc(100% - 32px);
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    z-index: 500;
    animation: slideDown 0.3s ease;
    text-align: center;
}

.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }

@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ===== Per-Venue Calendar Grid ===== */

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.cal-nav-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 18px;
    cursor: pointer;
    color: var(--text);
    min-width: 36px;
    text-align: center;
}

.cal-nav-btn:active {
    background: var(--bg);
}

.cal-nav-title {
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    flex: 1;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.cal-weekday {
    background: var(--card);
    padding: 6px 2px;
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-light);
    text-transform: uppercase;
}

.cal-day {
    background: var(--card);
    aspect-ratio: 1;
    padding: 2px;
    vertical-align: top;
    cursor: default;
    position: relative;
    font-size: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.cal-day.cal-other-month {
    opacity: 0.3;
}

.cal-day.cal-today {
    background: #fff8f0;
}

.cal-day.cal-empty {
    background: var(--bg);
}

.cal-day-num {
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 1px;
    flex-shrink: 0;
}

.cal-booking {
    font-size: 8px;
    padding: 1px 2px;
    border-radius: 3px;
    margin-bottom: 1px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-width: 100%;
    flex-shrink: 0;
    min-width: 0;
}

.cal-booking:active {
    opacity: 0.7;
}

.cal-booking.confirmed {
    background: #e8f8f5;
    color: #1a8a5c;
    border-left: 2px solid var(--success);
}

.cal-booking.scheduled {
    background: #e8f4fd;
    color: #206a9c;
    border-left: 2px solid var(--accent);
}

.cal-booking.completed {
    background: #f0f3f4;
    color: #7f8c8d;
    border-left: 2px solid #bdc3c7;
}

/* Responsive — wider screens */
@media (min-width: 768px) {
    .app-container {
        box-shadow: 0 0 20px rgba(0,0,0,0.05);
    }
}

/* ═══ Stats Dashboard (US-21/22/23) ═══ */
.stats-dashboard {
    padding: 4px 0;
}

.stats-summary-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.stats-summary-card {
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 12px 16px;
    flex: 1;
    min-width: 70px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stats-summary-num {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--primary, #e74c3c);
}

.stats-summary-label {
    display: block;
    font-size: 11px;
    color: var(--text-light, #888);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-card {
    transition: box-shadow 0.2s;
}

.stats-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.stats-card-detail {
    animation: fadeIn 0.2s ease;
}

.stats-age-fresh {
    background: #d4edda;
    color: #155724;
}

.stats-age-warn {
    background: #fff3cd;
    color: #856404;
}

.stats-age-stale {
    background: #f8d7da;
    color: #721c24;
}

/* ═══ Venue Stats Enhancements ═══ */
.stats-venue-header {
    margin-bottom: 12px;
}
.stats-venue-name {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.stats-section-header {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-light, #888);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 8px 0 6px;
    margin-top: 14px;
    border-bottom: 1px solid #eee;
}

.stats-booking-cards-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 8px;
    margin-bottom: 4px;
}

.stats-mini-card {
    flex: 1;
    min-width: 60px;
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 10px 8px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stats-mini-card.stats-green .stats-mini-num {
    color: #27ae60;
}

.stats-mini-num {
    font-size: 20px;
    font-weight: 700;
}

.stats-mini-label {
    font-size: 11px;
    color: var(--text-light, #888);
    margin-top: 2px;
}

.stats-empty {
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-light, #888);
    text-align: center;
}
.stats-empty-section {
    padding: 20px 0;
    font-size: 14px;
    color: var(--text-light, #888);
    text-align: center;
}

.stats-reach-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.stats-reach-card {
    flex: 1;
    min-width: 140px;
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 12px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stats-reach-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light, #888);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stats-reach-item {
    font-size: 13px;
    padding: 2px 0;
}

.stats-reach-icon {
    font-size: 14px;
}

.stats-incomplete-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 10px;
    padding: 12px 14px;
    cursor: pointer;
    transition: box-shadow 0.2s;
}
.stats-incomplete-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.stats-incomplete-left {
    display: flex;
    align-items: center;
    gap: 10px;
}
.stats-incomplete-num {
    font-size: 22px;
    font-weight: 700;
    color: #856404;
}
.stats-incomplete-left > div:last-child {
    font-size: 12px;
    color: #856404;
}
.stats-incomplete-right {
    display: flex;
    align-items: center;
}
.stats-chevron {
    font-size: 12px;
    color: #856404;
    transition: transform 0.2s;
}
.stats-chevron.open {
    transform: rotate(180deg);
}

.stats-incomplete-list {
    display: none;
    margin-top: 8px;
    margin-bottom: 4px;
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #ffc107;
}
.stats-incomplete-list.visible {
    display: block;
}
.stats-incomplete-content {
    font-size: 13px;
}
.stats-incomplete-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.stats-incomplete-item:last-child {
    border-bottom: none;
}
.stats-incomplete-name {
    font-weight: 500;
    font-size: 14px;
}
.stats-incomplete-meta {
    font-size: 11px;
    color: var(--text-light, #888);
    margin-top: 1px;
}
.stats-incomplete-actions {
    text-align: right;
}
.stats-incomplete-progress {
    font-size: 11px;
    color: #856404;
    margin-bottom: 4px;
}
.stats-incomplete-view-btn {
    margin-top: 2px;
}
.stats-incomplete-error {
    color: #e74c3c;
    font-size: 13px;
}

.stats-visitor-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}
.stats-visitor-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg, #fff);
    border-radius: 10px;
    padding: 10px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.stats-visitor-name {
    font-weight: 600;
    font-size: 14px;
    flex: 0 0 auto;
    margin-right: 8px;
}
.stats-visitor-stats {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--text-light, #888);
}
.stats-visitor-stat {
    white-space: nowrap;
}

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

/* ═══ Article Platform Selector (Redesign) ═══ */
.platform-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.platform-tab {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--border, #ddd);
    border-radius: 20px;
    background: #f5f5f5;
    color: #666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.platform-tab:hover {
    background: #ebebeb;
}

.platform-tab-active {
    background: var(--primary, #e74c3c);
    color: #fff;
    border-color: var(--primary, #e74c3c);
}

.platform-tab-active:hover {
    background: #c0392b;
}

.platform-tab-check {
    font-size: 11px;
    color: #27ae60;
    margin-left: 2px;
}

.platform-tab-active .platform-tab-check {
    color: #fff;
}

.platform-content {
    animation: fadeIn 0.2s ease;
}

.req-platforms-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    padding: 8px 10px;
    background: #f9f9f9;
    border-radius: 6px;
    font-size: 12px;
    align-items: center;
}

.req-platforms-bar > span {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light, #888);
    width: 100%;
}

.req-platforms-bar label {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.req-platforms-bar input[type="checkbox"] {
    margin: 0;
}

/* ── Mass Stats Scrape ─────────────────────────────────── */
.scrape-panel { margin-bottom: 16px; padding: 16px; background: var(--card-bg); border-radius: 12px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.scrape-panel h3 { font-size: 15px; font-weight: 600; margin-bottom: 12px; }
.scrape-scope-pills { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.scrape-scope-pill { padding: 6px 14px; border-radius: 20px; border: 1px solid var(--border); background: transparent; font-size: 13px; cursor: pointer; }
.scrape-scope-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.scrape-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.scrape-preview { padding: 12px; background: #f5f5f5; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.scrape-preview-row { display: flex; gap: 16px; margin-bottom: 4px; flex-wrap: wrap; }
.scrape-progress { padding: 12px; background: #f0f7ff; border: 1px solid #bdd3e8; border-radius: 8px; margin-bottom: 12px; }
.scrape-progress-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.scrape-progress-label { font-weight: 600; font-size: 14px; }
.scrape-progress-status { font-size: 13px; color: var(--text-light); }
.scrape-progress-bar-wrap { height: 8px; background: #e0e0e0; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.scrape-progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), #4f8ef7); border-radius: 4px; transition: width 0.5s ease; }
.scrape-progress-stats { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; }
.scrape-progress-time { font-size: 11px; color: var(--text-light); margin-top: 4px; }
.scrape-job-card { padding: 10px; background: #fafafa; border: 1px solid #eee; border-radius: 8px; margin-bottom: 8px; }
.scrape-job-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.scrape-job-card-stats { display: flex; gap: 12px; font-size: 12px; flex-wrap: wrap; }
.scrape-status-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.scrape-status-badge.running { background: #fff3cd; color: #856404; }
.scrape-status-badge.completed { background: #d4edda; color: #155724; }
.scrape-status-badge.failed { background: #f8d7da; color: #721c24; }
.scrape-params { margin-bottom: 12px; }
.scrape-params select, .scrape-params input { width: 100%; max-width: 300px; }
.scrape-history { margin-top: 16px; }
.scrape-done-actions { display: flex; gap: 8px; margin-top: 8px; }
