/* ==========================================================================
   Agency Portal — Styles
   --------------------------------------------------------------------------
   Self-contained CSS for the portal at grabcampaign.com. Includes design
   tokens, base element overrides, auth shell, portal topbar, and component
   styles. Bootstrap 5.3 is loaded first from CDN; this file overrides it
   the same way assets/app.css does in the main FlowMail app.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens (defaults — agency color overrides injected inline by
      layout_header.php so --accent / --accent-hover / --accent-light are
      set from the parent's chosen color scheme)
   -------------------------------------------------------------------------- */
:root {
    --accent:         #4f46e5;
    --accent-hover:   #4338ca;
    --accent-light:   #eef2ff;
    --accent-ring:    rgba(79, 70, 229, 0.15);

    --bg:             #fafafa;
    --surface:        #ffffff;
    --surface-alt:    #f8fafc;
    --border:         #e5e7eb;
    --border-strong:  #d1d5db;
    --text:           #0f172a;
    --text-secondary: #475569;
    --text-muted:     #94a3b8;

    --success:        #059669;
    --success-light:  #d1fae5;
    --danger:         #dc2626;
    --danger-light:   #fee2e2;
    --warning:        #d97706;
    --warning-light:  #fef3c7;
    --info:           #2563eb;
    --info-light:     #dbeafe;

    --radius-sm:      6px;
    --radius-md:      10px;
    --shadow-card:    0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-pop:     0 10px 25px rgba(15, 23, 42, 0.08), 0 2px 6px rgba(15, 23, 42, 0.04);
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--text);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
a { text-decoration: none; color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* --------------------------------------------------------------------------
   3. Buttons
   -------------------------------------------------------------------------- */
.btn { font-weight: 500; font-size: 14px; border-radius: var(--radius-sm); }
.btn-primary { background-color: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background-color: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-primary:focus-visible { box-shadow: 0 0 0 3px var(--accent-ring); }
.btn-outline-secondary { background-color: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-outline-secondary:hover { background-color: var(--surface-alt); }

/* --------------------------------------------------------------------------
   4. Forms
   -------------------------------------------------------------------------- */
.form-label { font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-control { font-size: 14px; padding: 9px 12px; min-height: 40px; border-color: var(--border-strong); border-radius: var(--radius-sm); }
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.form-group { margin-bottom: 16px; }

/* --------------------------------------------------------------------------
   5. Cards
   -------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); }
.card-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 20px; font-weight: 600; }
.card-body { padding: 20px; }

/* --------------------------------------------------------------------------
   6. Tables
   -------------------------------------------------------------------------- */
.table { --bs-table-bg: var(--surface); --bs-table-border-color: var(--border); margin-bottom: 0; }
.table > thead > tr > th { font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-muted); padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table > tbody > tr > td { font-size: 14px; padding: 14px 16px; vertical-align: middle; border-bottom: 1px solid var(--border); }
.table > tbody > tr:last-child > td { border-bottom: 0; }

/* --------------------------------------------------------------------------
   7. Alerts + Badges + Dropdowns
   -------------------------------------------------------------------------- */
.alert { border-radius: var(--radius-sm); font-size: 14px; }
.alert-success { background-color: var(--success-light); border-color: #a7f3d0; color: #065f46; }
.alert-danger { background-color: var(--danger-light); border-color: #fecaca; color: #991b1b; }

.badge { font-weight: 500; font-size: 11px; padding: 4px 8px; border-radius: var(--radius-sm); }
.badge.bg-primary { background-color: var(--accent-light) !important; color: var(--accent); }

.dropdown-menu { border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); padding: 6px; font-size: 14px; }
.dropdown-item { border-radius: var(--radius-sm); padding: 8px 12px; color: var(--text); }
.dropdown-item:hover { background-color: var(--surface-alt); }

/* --------------------------------------------------------------------------
   8. Flash toasts
   -------------------------------------------------------------------------- */
.fm-flash-toast { min-width: 280px; max-width: 400px; border-width: 1px; border-style: solid; border-radius: var(--radius-md); box-shadow: var(--shadow-pop); font-size: 14px; margin-bottom: 10px; }
.fm-flash-toast .toast-body { padding: 12px 8px 12px 16px; flex: 1; }
.fm-flash-toast.toast-success { background-color: var(--success-light); border-color: #a7f3d0; color: #065f46; }
.fm-flash-toast.toast-danger { background-color: var(--danger-light); border-color: #fecaca; color: #991b1b; }
.fm-flash-toast.toast-info { background-color: var(--info-light); border-color: #bfdbfe; color: #1e40af; }

/* --------------------------------------------------------------------------
   9. Auth shell (login + forgot password — unbranded)
   -------------------------------------------------------------------------- */
.auth-shell {
    min-height: 100vh;
    background-color: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 36px 32px 28px;
}

.auth-card h1 { font-size: 22px; text-align: center; margin-bottom: 4px; }
.auth-card .auth-subtitle { font-size: 14px; color: var(--text-secondary); text-align: center; margin-bottom: 24px; }
.auth-footer { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); text-align: center; font-size: 13px; color: var(--text-secondary); }
.auth-footer a { color: var(--accent); font-weight: 500; }

/* --------------------------------------------------------------------------
   10. Portal topbar (branded, shown after login)
   -------------------------------------------------------------------------- */
.portal-topbar {
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.portal-topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.portal-logo {
    max-height: 40px;
    max-width: 180px;
    flex-shrink: 0;
}

.portal-brand-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    max-width: 300px;
    overflow: hidden;
}

.portal-user-btn {
    background: transparent;
    border: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px 4px 4px;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}
.portal-user-btn:hover { background-color: var(--surface-alt); }
.portal-user-btn::after { display: none !important; }

.portal-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   11. Portal content area
   -------------------------------------------------------------------------- */
.portal-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 24px;
}

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 24px; margin-bottom: 4px; }
.page-header p { color: var(--text-secondary); margin: 0; font-size: 14px; }

/* --------------------------------------------------------------------------
   12. Email cards (campaign preview)
   -------------------------------------------------------------------------- */
.email-body {
    font-size: 14px;
    line-height: 1.65;
    color: var(--text);
}

/* Copy dropdown styling (same as main app) */
.copy-dropdown .dropdown-item { white-space: normal; }
