/* ── ALC User Dashboard ─────────────────────────────────────────────── */

/* ── Root container ─────────────────────────────────────────────────── */
#alc-dashboard-root {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
    color: #1a202c;
}
#alc-dashboard-root *, #alc-dashboard-root *::before, #alc-dashboard-root *::after {
    box-sizing: border-box;
}

/* ── Header bar ─────────────────────────────────────────────────────── */
.alc-dash-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 12px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #2c5282 0%, #4a6fa5 100%);
    border-radius: 12px 12px 0 0;
    color: #fff;
}
.alc-dash-header h2 {
    margin: 0;
    font-size: 1.25em;
    font-weight: 700;
    color: #fff;
    word-break: break-word;
}
.alc-dash-header p {
    margin: 2px 0 0;
    font-size: 0.85em;
    opacity: 0.82;
    word-break: break-all;
}

/* Left side: name + email */
.alc-dash-header > div:first-child {
    flex: 1 1 160px;
    min-width: 0;
}

/* Right side: badge + buttons */
.alc-dash-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
}

/* Plan badge */
.alc-dash-plan-badge {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.82em;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
}
.alc-dash-plan-badge.pro  { background: #d69e2e; color: #fff; }
.alc-dash-plan-badge.free { background: rgba(255,255,255,0.2); color: #fff; }

/* Action buttons row (WhatsApp + logout) */
.alc-dash-header-actions {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    justify-content: flex-end;
}

/* Logout button */
.alc-dash-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 13px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.alc-dash-logout-btn:hover {
    background: rgba(255,255,255,0.28);
    border-color: rgba(255,255,255,0.6);
    color: #fff;
    text-decoration: none;
}

/* WhatsApp support button */
.alc-dash-wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 13px;
    background: #25D366;
    color: #fff;
    border: 1px solid #1ebe5d;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}
.alc-dash-wa-btn:hover {
    background: #1ebe5d;
    border-color: #17a852;
    color: #fff;
    text-decoration: none;
}

/* ── Collapse/expand toggle bar ─────────────────────────────────────── */
.alc-dash-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 6px;
    padding: 7px 16px;
    border: 1px solid #d1dce8;
    border-top: none;
    background: #eef3fa;
    color: #4a6fa5;
    border-radius: 0 0 10px 10px;
    font-size: 0.82em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    margin-bottom: 20px;
}
.alc-dash-collapse-btn:hover { background: #dce8f7; color: #2c5282; }

/* ── Collapsed body ─────────────────────────────────────────────────── */
#alc-dash-body {
    overflow: hidden;
    max-height: 4000px;
    transition: max-height 0.4s ease, opacity 0.35s ease;
    opacity: 1;
}
#alc-dash-body.collapsed {
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease;
}

/* ── Stat cards ─────────────────────────────────────────────────────── */
.alc-dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}
.alc-dash-stat-card {
    background: #f0f6ff;
    border: 1.5px solid #c3dafe;
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s;
    /* reset button styles */
    font-family: inherit;
    outline: none;
    box-shadow: none;
    width: 100%;
}
.alc-dash-stat-card:hover {
    background: #dbeafe;
    border-color: #2c5282;
    box-shadow: 0 2px 8px rgba(44,82,130,0.12);
    transform: translateY(-2px);
}
.alc-dash-stat-card:active {
    transform: translateY(0);
    background: #bfdbfe;
}
.alc-dash-stat-card .stat-val {
    font-size: 1.5em;
    font-weight: 800;
    color: #2c5282;
    line-height: 1.2;
}
.alc-dash-stat-card .stat-label {
    font-size: 0.7em;
    color: #4a6fa5;
    margin-top: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Tabs ───────────────────────────────────────────────────────────── */
.alc-dash-tabs {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 20px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.alc-dash-tabs::-webkit-scrollbar { display: none; }
.alc-dash-tab {
    padding: 8px 14px;
    border: none;
    background: none;
    font-size: 0.85em;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    white-space: nowrap;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.alc-dash-tab:hover { color: #2c5282; background: #f0f6ff; }
.alc-dash-tab.active {
    color: #2c5282;
    border-bottom-color: #2c5282;
    background: #f0f6ff;
}

/* ── Account panel ──────────────────────────────────────────────────── */
.alc-dash-account-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.alc-dash-info-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 18px 20px;
    min-width: 0;
}
.alc-dash-info-card h4 {
    margin: 0 0 12px;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #718096;
    font-weight: 700;
}
.alc-dash-info-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    padding: 7px 0;
    border-bottom: 1px solid #f0f4f8;
    font-size: 0.88em;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.alc-dash-info-row:last-child { border-bottom: none; }
.alc-dash-info-row .label { color: #718096; flex-shrink: 0; }
.alc-dash-info-row .value { font-weight: 600; color: #2d3748; word-break: break-word; text-align: right; }

/* ── Upgrade banner ─────────────────────────────────────────────────── */
.alc-dash-upgrade-banner {
    background: linear-gradient(135deg, #744210 0%, #d69e2e 100%);
    color: #fff;
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: 20px;
}
.alc-dash-upgrade-banner p { margin: 0; font-size: 0.88em; opacity: 0.92; }
.alc-dash-upgrade-banner h3 { margin: 0 0 4px; font-size: 1em; }
.alc-dash-upgrade-banner a {
    background: #fff;
    color: #744210;
    font-weight: 700;
    font-size: 0.85em;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Tables ─────────────────────────────────────────────────────────── */
.alc-dash-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.alc-dash-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.86em;
    min-width: 520px;
}
.alc-dash-table th {
    background: #f7fafc;
    color: #718096;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.76em;
    padding: 9px 10px;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.alc-dash-table td {
    padding: 9px 10px;
    border-bottom: 1px solid #f0f4f8;
    vertical-align: middle;
}
.alc-dash-table tr:last-child td { border-bottom: none; }
.alc-dash-table tr:hover td { background: #f7fafc; }

/* ── Panel toolbar ──────────────────────────────────────────────────── */
.alc-dash-panel-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

/* ── Table action buttons ───────────────────────────────────────────── */
.alc-dash-btn {
    padding: 4px 8px;
    border-radius: 5px;
    border: 1px solid transparent;
    cursor: pointer;
    font-size: 0.76em;
    font-weight: 600;
    transition: opacity 0.15s;
    white-space: nowrap;
}
.alc-dash-btn:hover { opacity: 0.8; }
.alc-dash-btn.load    { background: #ebf8ff; color: #2b6cb0; border-color: #bee3f8; }
.alc-dash-btn.compare { background: #f0fff4; color: #276749; border-color: #9ae6b4; }
.alc-dash-btn.delete  { background: #fff5f5; color: #c53030; border-color: #fed7d7; }
.alc-dash-btn.refresh { background: #f7fafc; color: #4a6fa5; border-color: #c3dafe; padding: 5px 14px; font-size: 0.85em; }

/* ── Empty state ────────────────────────────────────────────────────── */
.alc-dash-empty {
    text-align: center;
    padding: 36px 20px;
    color: #a0aec0;
    font-size: 0.92em;
}
.alc-dash-empty .icon { font-size: 2.4em; display: block; margin-bottom: 10px; }

/* ── Oil / Ingredient tags ──────────────────────────────────────────── */
.alc-dash-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.alc-dash-tag {
    background: #edf2f7;
    color: #4a5568;
    border-radius: 4px;
    padding: 2px 7px;
    font-size: 0.76em;
    font-weight: 600;
}

/* ── Toast ──────────────────────────────────────────────────────────── */
.alc-dash-toast {
    position: fixed;
    bottom: 20px;
    right: 16px;
    left: 16px;
    max-width: 360px;
    margin: 0 auto;
    background: #276749;
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 0.88em;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.18);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.alc-dash-toast.show { opacity: 1; transform: translateY(0); }
.alc-dash-toast.error { background: #9b2c2c; }

/* ══════════════════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ══════════════════════════════════════════════════════════════════════ */

/* Tablet — ≤768px */
@media (max-width: 768px) {
    .alc-dash-header { padding: 16px 18px; gap: 10px; }
    .alc-dash-stats { grid-template-columns: repeat(4, 1fr); gap: 8px; }
    .alc-dash-account-grid { grid-template-columns: 1fr; gap: 12px; }
    .alc-dash-tab { padding: 7px 12px; font-size: 0.82em; }
}

/* Mobile — ≤480px */
@media (max-width: 480px) {
    .alc-dash-header { padding: 14px 14px; gap: 8px; }
    .alc-dash-header h2 { font-size: 1.1em; }
    .alc-dash-header p { font-size: 0.78em; }

    .alc-dash-plan-badge { font-size: 0.72em; padding: 4px 9px; }
    .alc-dash-wa-btn { font-size: 0.72em; padding: 5px 10px; }
    .alc-dash-logout-btn { font-size: 0.72em; padding: 5px 10px; }
    .alc-dash-collapse-btn { font-size: 0.78em; padding: 7px 12px; }

    .alc-dash-stats { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    .alc-dash-stat-card { padding: 12px 10px; }
    .alc-dash-stat-card .stat-val { font-size: 1.6em; }
    .alc-dash-stat-card .stat-label { font-size: 0.7em; }

    .alc-dash-tabs { gap: 0; }
    .alc-dash-tab { padding: 7px 10px; font-size: 0.78em; }

    .alc-dash-info-card { padding: 14px 14px; }
    .alc-dash-table { font-size: 0.82em; }
    .alc-dash-table th, .alc-dash-table td { padding: 7px 8px; }

    .alc-dash-upgrade-banner { padding: 14px 16px; }
    .alc-dash-upgrade-banner h3 { font-size: 0.95em; }
    .alc-dash-upgrade-banner p { font-size: 0.82em; }
}

/* Very small phones — ≤360px */
@media (max-width: 360px) {
    .alc-dash-header { padding: 12px 12px; }
    .alc-dash-header-actions { gap: 6px; }
    .alc-dash-wa-btn, .alc-dash-logout-btn { font-size: 0.68em; padding: 4px 8px; }
    .alc-dash-stats { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .alc-dash-stat-card .stat-val { font-size: 1.4em; }
}

/* ── Panel show/hide ──────────────────────────────────────────────────────── */
.alc-dash-panel {
    display: none;
}
.alc-dash-panel.active {
    display: block;
}

/* ── Plan cards under Account ─────────────────────────────────────────────── */
.alc-dash-plan-card-wrap {
    margin-top: 20px;
}
.alc-dash-plan-card-heading {
    font-size: 0.85em;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 0 0 12px;
}
.alc-dash-plan-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
}
.alc-dash-plan-item {
    position: relative;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px 12px 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: box-shadow .15s;
}
.alc-dash-plan-item.best {
    border-color: #d69e2e;
    background: #fffbeb;
}
.alc-dash-plan-item.current {
    border-color: #2c5282;
    background: #ebf4ff;
}
.alc-plan-badge {
    position: absolute;
    top: -11px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 0.68em;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 20px;
}
.alc-plan-badge.best-badge   { background: #d69e2e; color: #fff; }
.alc-plan-badge.active-badge { background: #2c5282; color: #fff; }
.alc-plan-label {
    font-size: 0.82em;
    font-weight: 700;
    color: #374151;
    margin-top: 6px;
}
.alc-plan-price {
    font-size: 1.35em;
    font-weight: 800;
    color: #1a7a4a;
}
.alc-plan-daily {
    font-size: 0.72em;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    justify-content: center;
}
.alc-plan-save {
    background: #fef3c7;
    color: #92400e;
    border-radius: 20px;
    padding: 1px 7px;
    font-weight: 700;
    font-size: 0.95em;
}
.alc-plan-btn {
    margin-top: 4px;
    display: inline-block;
    background: #22c55e;
    color: #fff;
    font-weight: 700;
    font-size: 0.78em;
    padding: 6px 14px;
    border-radius: 6px;
    text-decoration: none;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    transition: background .15s;
}
.alc-plan-btn:hover  { background: #16a34a; color: #fff; }
.alc-plan-btn.active-btn { background: #2c5282; cursor: default; pointer-events: none; }

@media (max-width: 480px) {
    .alc-dash-plan-cards { grid-template-columns: 1fr 1fr; }
}

.alc-dash-stat-card.active {
    background: #2c5282;
    border-color: #2c5282;
    box-shadow: 0 4px 12px rgba(44,82,130,0.25);
}
.alc-dash-stat-card.active .stat-val,
.alc-dash-stat-card.active .stat-label {
    color: #fff;
}

/* ── Name column — wider in all dashboard tables ─────────────────────── */
.alc-dash-table th:first-child,
.alc-dash-table td:first-child {
    min-width: 160px;
    width: 200px;
    max-width: 260px;
    white-space: normal;
    word-break: break-word;
}

/* WhatsApp upgrade button */
.alc-plan-btn.wa-upgrade-btn {
    background: #25D366;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}
.alc-plan-btn.wa-upgrade-btn:hover {
    background: #128C7E;
    color: #fff;
}

/* ── Vertical plan cards (matches upgrade modal) ─────────────────────── */
.alc-dash-plan-card-heading {
    font-size: 0.75em;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #888;
    text-transform: uppercase;
    margin: 0 0 10px;
}
.alc-dash-vcards {
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.alc-dash-plan-vcard {
    position: relative;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.alc-dash-plan-vcard.alc-dash-vcard-active {
    border-color: #2c5282;
    border-width: 2px;
    background: #f0f6ff;
}
.alc-dash-plan-vcard.alc-dash-vcard-best {
    border-color: #d97706;
    border-width: 2px;
}
.alc-dash-card-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.72em;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 20px;
    white-space: nowrap;
}
.alc-dash-card-badge.best { background: #d97706; color: #fff; }
.alc-dash-card-header {
    text-align: center;
}
.alc-dash-card-name {
    font-size: 1.1em;
    font-weight: 700;
    color: #1a1a1a;
    margin-bottom: 4px;
}
.alc-dash-card-price {
    font-size: 1.6em;
    font-weight: 800;
    color: #2a9d2a;
    line-height: 1.1;
}
.alc-dash-card-daily {
    font-size: 0.78em;
    color: #888;
    margin-top: 2px;
}
.alc-dash-card-active-badge {
    display: inline-block;
    margin-top: 6px;
    background: #2c5282;
    color: #fff;
    font-size: 0.72em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}
/* Feature checklist inside card */
.alc-dash-card-details {
    margin: 4px 0;
}
.alc-dash-feat-heading {
    font-size: 0.72em;
    font-weight: 700;
    color: #777;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}
.alc-dash-feat-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.85em;
}
.alc-dash-feat-check { font-size: 1em; flex-shrink: 0; }
.alc-dash-feat-text  { color: #222; }
.alc-dash-feat-dim   { color: #bbb; }
.alc-dash-feat-limit { font-weight: 700; color: #2a9d2a; margin-left: 4px; }
/* Card buttons */
.alc-dash-card-btn {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.95em;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: background .15s;
}
.alc-dash-card-btn-active {
    background: #2c5282;
    color: #fff;
    pointer-events: none;
}
.alc-dash-card-btn-wa {
    background: #25D366;
    color: #fff;
}
.alc-dash-card-btn-wa:hover { background: #128C7E; color: #fff; }
