/* WatchIt 2.0 theme for the sponsor portal.
 *
 * Watch It 2.0 design system: light throughout -- lavender page, white cards
 * with soft lavender shadows, a white sidebar with a violet gradient pill on
 * the active item, and pastel icon chips on the stat tiles. Loaded
 * AFTER adminlte.min.css so it overrides AdminLTE in place -- the templates
 * keep their Bootstrap markup, which is why this is one file instead of nine
 * rewrites.
 */

/* The design-system tokens. Everything below is expressed in these, and the
 * public site (watchit-public.css) repeats the same block, so a palette
 * change is two files and never a sweep through the templates. */
:root {
    --radius: 12px;
    --radius-lg: 16px;

    --primary: #6D28D9;
    --deep-purple: #241044;
    --accent-violet: #8B5CF6;
    --background: #F7F5FF;
    --card: #FFFFFF;
    --foreground: #17132D;
    --muted-foreground: #6B6680;
    --border: #E8E1F5;
    --success: #16A34A;
    --destructive: #EF4444;

    --primary-foreground: #FFFFFF;
    --primary-light: #A78BFA;
    --primary-gradient: linear-gradient(135deg, #8B5CF6 0%, #6D28D9 100%);
    --accent: #F0EAFF;
    --muted: #F4F0FE;
    --success-soft: #DCFCE7;
    --warning: #D97706;
    --warning-soft: #FEF3C7;
    /* "info" is a violet here, not a blue: the design system palette has no
     * blue in it, so a blue chip or badge read as a foreign colour. */
    --info: #8B5CF6;
    --info-soft: #EDE9FE;
    --danger-soft: #FEE2E2;

    /* Row hover. The other aliases that lived here (--signal, --secondary,
     * --soft-coral, --footer-muted, --footer-border) existed for inline styles
     * in the templates; nothing reads them any more, so they are gone. */
    --soft-gold: #F7F4FF;

    /* Minimal borders, and shadows tinted lavender rather than grey. */
    --edge: 1px solid var(--border);
    --shadow-sm: 0 1px 2px rgba(109, 40, 217, 0.05), 0 2px 8px rgba(109, 40, 217, 0.06);
    --shadow-md: 0 2px 4px rgba(109, 40, 217, 0.05), 0 10px 28px rgba(109, 40, 217, 0.08);
    --shadow-violet: 0 8px 20px rgba(109, 40, 217, 0.3);
}

/* ---------- type ---------- */

body,
.wrapper {
    background-color: var(--background);
    color: var(--foreground);
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.9rem;
    letter-spacing: 0;
}

h1, h2, h3, h4, h5, h6,
.card-title,
.brand-text,
.metric-value,
.small-box .inner h3,
.modal-title {
    font-family: "Poppins", -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--foreground);
}

.content-header h1 {
    font-size: 1.75rem;
    line-height: 1.2;
}

.content-header h1 small {
    display: block;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--muted-foreground);
    margin-top: 2px;
}

label,
.metric-label,
.small-box .inner p,
.form-text {
    font-size: 0.82rem;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    color: var(--muted-foreground);
}

label {
    color: var(--foreground);
    margin-bottom: 0.35rem;
}

.breadcrumb-item {
    font-size: 0.8rem;
    font-weight: 500;
}

.form-text,
.text-muted {
    color: var(--muted-foreground) !important;
}

/* ---------- logo lockup ---------- */

/* Play mark is a purple SVG on transparent; WATCH / IT stay live Poppins text
 * in deep purple and violet. Every surface the lockup sits on is light. */
.wi-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none !important;
}

.wi-logo img,
.wi-logo .wi-logo__mark {
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
}

.wi-logo__word {
    font-family: "Poppins", sans-serif;
    font-weight: 800;
    font-size: 1.2rem;
    line-height: 1;
    letter-spacing: 0.04em;
    color: var(--deep-purple);
    text-transform: uppercase;
}

.wi-logo__word b {
    font-weight: 800;
    color: var(--accent-violet);
}


/* Bootstrap colours a bare <a> #007bff. Nothing here overrode it, so every
 * link that was not inside .main-footer or .sponsor-policies came out blue --
 * "Create an account", the resend-email link, the breadcrumb. Class-based
 * links (.btn, .nav-link, .dropdown-item, .brand-link) all out-specify this
 * element selector, so they keep their own colours. */
a {
    color: var(--primary);
}

a:hover,
a:focus {
    color: var(--deep-purple);
}

/* Bootstrap sets .text-primary with !important, so matching it takes one. */
.text-primary {
    color: var(--primary) !important;
}

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

.btn-link:hover,
.btn-link:focus {
    color: var(--deep-purple);
}

.page-link {
    color: var(--primary);
}

.page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
}

.nav-tabs .nav-link.active {
    color: var(--primary);
}

/* ---------- shell ---------- */

.main-header.navbar {
    background-color: var(--card);
    border: 0;
    border-bottom: var(--edge);
    box-shadow: var(--shadow-sm);
}

.main-header .nav-link {
    color: var(--foreground);
    font-weight: 500;
    font-size: 0.88rem;
}

.main-header .nav-link:hover {
    color: var(--primary);
}

/* A white panel separated by a rule rather than a shadow. The aside carries no
 * AdminLTE colour variant and no elevation class, so nothing here is fighting
 * a !important box-shadow or a .sidebar-dark-* rule. */
.main-sidebar {
    background-color: var(--card);
    border-right: var(--edge);
    box-shadow: none;
}

.brand-link {
    background: transparent !important;
    border-bottom: var(--edge) !important;
    text-decoration: none !important;
    padding: 0.9rem 1rem;
}

.brand-link .brand-text {
    color: var(--foreground);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.02em;
}

.nav-sidebar .nav-link {
    border-radius: var(--radius);
    margin: 3px 10px;
    padding: 0.65rem 0.85rem;
    color: var(--muted-foreground);
    font-weight: 500;
    text-transform: none;
    font-size: 0.88rem;
    border-left: 0;
}

.nav-sidebar .nav-link:hover {
    background-color: var(--accent);
    color: var(--primary);
}

.nav-sidebar .nav-link.active {
    background: var(--primary-gradient) !important;
    color: #fff !important;
    border-left: 0;
    box-shadow: var(--shadow-violet);
}

.nav-sidebar .nav-icon {
    width: 1.3rem;
}

.nav-sidebar .nav-header {
    color: var(--muted-foreground);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    padding: 1rem 1.4rem 0.35rem;
    background: transparent;
}

.content-wrapper {
    background-color: var(--background);
    background-image:
        radial-gradient(circle at 8% 0%, rgba(139, 92, 246, 0.1), transparent 40%),
        radial-gradient(circle at 100% 20%, rgba(109, 40, 217, 0.06), transparent 36%);
    background-attachment: fixed;
}

.content-header {
    border-bottom: 0;
    background-color: transparent;
    padding: 1.25rem 0.5rem 0.5rem;
}

.breadcrumb {
    background: transparent;
}

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

.main-footer {
    background-color: var(--card);
    color: var(--muted-foreground);
    border-top: var(--edge);
    font-size: 0.82rem;
}

.main-footer a {
    color: var(--primary);
}

/* ---------- surfaces ---------- */

.card,
.modal-content,
.table-responsive,
.info-box,
.small-box {
    border: var(--edge);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    background-color: var(--card);
}

.card {
    box-shadow: var(--shadow-md);
}

.card-header {
    border-bottom: var(--edge);
    background-color: transparent;
    padding: 1rem 1.25rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 800;
    text-transform: none;
}

.card-body {
    padding: 1.25rem;
}

/* AdminLTE's coloured card accent is a thin top rule, and the old theme made
 * it a thick slab. Here the accent is a tinted title icon instead, so the
 * rule goes back to being just an edge. */
.card-outline.card-primary,
.card-primary:not(.card-outline),
.card-outline.card-success,
.card-success:not(.card-outline),
.card-outline.card-danger,
.card-danger:not(.card-outline) {
    border-top: var(--edge);
}

.card-primary:not(.card-outline) > .card-header,
.card-success:not(.card-outline) > .card-header,
.card-danger:not(.card-outline) > .card-header {
    background-color: transparent;
    color: var(--foreground);
}

.card-primary > .card-header .card-title i {
    color: var(--primary);
}

.card-success > .card-header .card-title i {
    color: var(--success);
}

.card-danger > .card-header .card-title i {
    color: var(--destructive);
}

/* Stat tiles: white card, pastel rounded icon chip on the left, dark numeral
 * and a plain-case grey caption -- not AdminLTE's gradient slab with a faded
 * giant glyph bleeding out of the corner. */
.small-box {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    padding: 1.1rem 1.15rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.small-box > .inner {
    order: 2;
    padding: 0;
    flex: 1 1 auto;
    min-width: 0;
}

.small-box .inner h3 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 2px;
    color: inherit;
}

.small-box .inner p {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.3;
}

.small-box > .icon {
    order: 1;
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    z-index: auto !important;
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex !important;
    align-items: center;
    justify-content: center;
    opacity: 1 !important;
    background-color: var(--accent);
    color: var(--primary) !important;
    transition: none;
    overflow: hidden;
}

/* AdminLTE absolutely parks the glyph in the top-right of the card; pin it
 * back inside the chip or the pastel square looks empty. */
.small-box .icon > i {
    position: static !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    display: block !important;
    font-size: 1.25rem !important;
    line-height: 1 !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    opacity: 1 !important;
    color: inherit !important;
}

/* One hero tile carries the brand gradient; the rest stay white so the row
 * reads as data, not as ten competing colour blocks. */
.small-box.bg-secondary {
    background: var(--primary-gradient) !important;
    border-color: transparent;
    color: #fff !important;
    box-shadow: var(--shadow-violet);
}

.small-box.bg-secondary .inner h3,
.small-box.bg-secondary .inner p {
    color: #fff !important;
}

.small-box.bg-secondary > .icon {
    background-color: rgba(255, 255, 255, 0.18);
    color: #fff !important;
}

.small-box.bg-success,
.small-box.bg-warning,
.small-box.bg-info,
.small-box.bg-danger,
.small-box.bg-primary {
    background-color: var(--card) !important;
    color: var(--foreground) !important;
}

.small-box.bg-success .inner p,
.small-box.bg-warning .inner p,
.small-box.bg-info .inner p,
.small-box.bg-danger .inner p,
.small-box.bg-primary .inner p {
    color: var(--muted-foreground) !important;
}

.small-box.bg-success > .icon {
    background-color: var(--success-soft);
    color: var(--success) !important;
}

.small-box.bg-warning > .icon {
    background-color: var(--warning-soft);
    color: var(--warning) !important;
}

.small-box.bg-info > .icon {
    background-color: var(--info-soft);
    color: var(--info) !important;
}

.small-box.bg-danger > .icon {
    background-color: var(--danger-soft);
    color: var(--destructive) !important;
}

/* ---------- controls ---------- */

.btn {
    border-radius: var(--radius);
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.85rem;
    padding: 0.5rem 1.1rem;
    border-width: 1px;
    transition: transform 120ms ease, box-shadow 160ms ease, background-color 160ms ease;
}

.btn-primary {
    background: var(--primary-gradient);
    border-color: transparent;
    color: var(--primary-foreground);
    box-shadow: var(--shadow-violet);
}

.btn-primary:hover,
.btn-primary:focus {
    background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
    border-color: transparent;
    color: #fff;
}

/* Consent checkbox + policy links: match primary purple (not Bootstrap blue). */
.custom-control-input:checked ~ .custom-control-label::before {
    background-color: var(--primary);
    border-color: var(--primary);
}

.custom-control-input:focus ~ .custom-control-label::before {
    box-shadow: 0 0 0 0.2rem rgba(109, 40, 217, 0.25);
}

.custom-control-input:not(:disabled):active ~ .custom-control-label::before {
    background-color: var(--accent-violet);
    border-color: var(--accent-violet);
    color: #fff;
}

.sponsor-policies a {
    color: var(--primary);
}

.sponsor-policies a:hover,
.sponsor-policies a:focus {
    color: var(--deep-purple);
}

.btn-success {
    background-color: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-success:hover {
    background-color: #15803d;
    border-color: #15803d;
    color: #fff;
}

/* Boost CTA uses the primary purple gradient so it matches the design system. */
.btn-boost {
    background: var(--primary-gradient);
    border-color: transparent;
    color: #fff;
    box-shadow: var(--shadow-violet);
}

.btn-boost:hover,
.btn-boost:focus {
    background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
    border-color: transparent;
    color: #fff;
}

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

.btn-secondary,
.btn-outline-secondary,
.btn-outline-primary,
.btn-default {
    background-color: var(--card);
    border: var(--edge);
    color: var(--foreground);
    box-shadow: var(--shadow-sm);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary-light);
}

.btn-secondary:hover,
.btn-outline-secondary:hover,
.btn-outline-primary:hover,
.btn-default:hover {
    background-color: var(--accent);
    color: var(--primary);
    border-color: var(--primary);
}

.btn:active {
    transform: translateY(1px);
}

.form-control,
.custom-select,
.input-group-text {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background-color: var(--card);
    color: var(--foreground);
    font-weight: 400;
    font-size: 0.88rem;
    padding: 0.5rem 0.85rem;
    height: auto;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.input-group-text {
    background-color: var(--muted);
    font-weight: 500;
    color: var(--muted-foreground);
}

/* ---------- data ---------- */

.table {
    color: var(--foreground);
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--muted);
    color: var(--muted-foreground);
    border: 0;
    text-transform: none;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0;
    padding: 0.8rem 0.9rem;
}

.table td,
.table th {
    border-top: 1px solid var(--border);
    vertical-align: middle;
    padding: 0.8rem 0.9rem;
}

.table-hover tbody tr:hover {
    background-color: var(--soft-gold);
    color: var(--foreground);
}

.table-responsive {
    box-shadow: var(--shadow-sm);
}

/* A card already draws the border and shadow; a table inside one should not
 * draw a second set. */
.card .table-responsive {
    border: 0;
    box-shadow: none;
}

/* Row actions (campaigns list). The markup carries .btn-group-actions, but the
 * rule for it only ever existed in admin/base.html -- the sponsor portal does
 * not load that file, so these buttons fell back to inline-block and wrapped
 * into a ragged stack with nothing but whitespace between them. */
.btn-group-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
}

.btn-group-actions .btn {
    margin: 0;
}

.badge {
    border-radius: 999px;
    border: 0;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
    font-size: 0.74rem;
    padding: 0.4em 0.75em;
}

.badge-success { background-color: var(--success-soft); color: #15803d; }
.badge-warning { background-color: var(--warning-soft); color: #b45309; }
.badge-danger  { background-color: var(--danger-soft); color: #b91c1c; }
.badge-info    { background-color: var(--info-soft); color: var(--primary); }
.badge-primary { background-color: var(--accent); color: var(--primary); }
.badge-secondary { background-color: var(--muted); color: var(--muted-foreground); }

.alert {
    border: var(--edge);
    border-radius: var(--radius);
    box-shadow: none;
    font-weight: 400;
}

.alert-success { background-color: var(--success-soft); border-color: #bbf7d0; color: #166534; }
.alert-danger  { background-color: var(--danger-soft); border-color: #fecaca; color: #991b1b; }
.alert-info    { background-color: var(--accent); border-color: #ddd6fe; color: #5b21b6; }
.alert-warning { background-color: var(--warning-soft); border-color: #fde68a; color: #92400e; }

.modal-content {
    box-shadow: var(--shadow-md);
}

.modal-header,
.modal-footer {
    border-color: var(--border);
    border-width: 1px;
}

.progress {
    border-radius: 999px;
    border: 0;
    background-color: var(--muted);
}

.progress-bar {
    background: var(--primary-gradient);
}

.dropdown-menu {
    border: var(--edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.dropdown-item:hover {
    background-color: var(--accent);
    color: var(--primary);
}

.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--muted-foreground);
}

.empty-state i {
    font-size: 3rem;
    opacity: 0.35;
    margin-bottom: 15px;
    display: block;
    color: var(--primary);
}

.metric-value {
    font-size: 1.9rem;
    font-weight: 800;
    line-height: 1.1;
}

/* ---------- login / signup ---------- */

/* These pages sit outside the dashboard shell; they get the same neutral
 * ground with a soft violet wash instead of the old grid paper. */
body.sponsor-auth {
    background-color: var(--background);
    background-image:
        radial-gradient(circle at 15% 10%, rgba(124, 58, 237, 0.14), transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.12), transparent 45%);
    background-attachment: fixed;
    min-height: 100vh;
}

.sponsor-auth .card {
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 40px rgba(22, 22, 44, 0.1);
}

.sponsor-auth .login-logo .wi-logo__word,
.sponsor-auth .register-logo .wi-logo__word {
    font-size: 1.6rem;
}

.sponsor-auth .login-logo__sub {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted-foreground);
}

.sponsor-auth .login-box-msg,
.sponsor-auth .register-box-msg {
    font-size: 0.88rem;
    font-weight: 400;
    text-transform: none;
    color: var(--muted-foreground);
}

.dash-chart-frame {
    position: relative;
    height: 260px;
}

/* ---------- mobile ---------- */

/* Nothing on a page may force the viewport wider than itself. A single long
 * campaign title or a wide table used to drag the whole layout sideways, which
 * leaves every other page element scrolled off-centre. */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

.content-wrapper,
.container-fluid,
.card,
.table-responsive {
    max-width: 100%;
}

/* Long unbroken strings -- YouTube URLs, campaign titles, sponsor emails --
 * are the usual culprit. */
.card-body,
.table td,
.breadcrumb-item {
    overflow-wrap: break-word;
}

@media (max-width: 768px) {
    .content-header {
        padding: 1rem 0.5rem 0.25rem;
    }

    .content-header h1 {
        font-size: 1.4rem;
    }

    .content-header h1 small {
        font-size: 0.78rem;
    }

    /* It sits under the title at this width, so the desktop float would leave
     * it hugging the right edge away from everything it relates to. */
    .breadcrumb.float-sm-right {
        float: none !important;
        padding-left: 0;
        margin-bottom: 0;
    }

    .card-body,
    .card-header {
        padding: 1rem;
    }

    .metric-value,
    .small-box .inner h3 {
        font-size: 1.45rem;
    }

    /* 16px is the threshold below which iOS Safari zooms the page on focus.
     * At 0.88rem every tap into a field zoomed the layout and left the user to
     * pinch back out -- on the create-task form, once per field. */
    .form-control,
    .custom-select,
    .input-group-text,
    textarea.form-control,
    select.form-control {
        font-size: 16px;
    }

    /* 44px is the tap-target floor; the desktop padding gives about 38px. */
    .btn {
        min-height: 44px;
        padding: 0.6rem 1rem;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.35rem 0.7rem;
    }

    /* Any button alone in a flex column is an action, not a chip -- let it
     * fill the row rather than sit at some arbitrary intrinsic width. */
    .card-body > .d-flex.flex-column > .btn,
    .modal-footer .btn {
        width: 100%;
    }

    .modal-footer .btn + .btn {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .modal-footer {
        display: block;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .table td,
    .table th {
        padding: 0.6rem 0.5rem;
    }

    /* Stacked, because a row of three in a table cell is unreachable at this
     * width. align-items:stretch is what squares the edge off -- left to
     * themselves the buttons size to their labels and step in and out. */
    .btn-group-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.35rem;
    }

    .btn-group-actions .btn {
        width: 100%;
        min-height: 38px;
    }

    /* A fixed 260px of chart is a lot of a phone screen, and the horizontal
     * bars need less height than they do width. */
    .dash-chart-frame {
        height: 220px;
    }

    .main-footer {
        text-align: center;
        padding: 1rem;
    }
}

/* Two stat tiles per row stays worth it down here -- it halves the scrolling --
 * but the icon chip and numeral both have to give ground to fit beside it.
 *
 * The .dash-stats selectors carry a .content-wrapper prefix on purpose. The
 * dashboard sets its own tile sizes in a {% block extra_css %} <style>, which
 * the base template emits AFTER this file; at equal specificity that inline
 * block wins and these rules would silently do nothing. A media query adds no
 * specificity of its own, so the extra ancestor is what makes them apply. */
@media (max-width: 575px) {
    .small-box,
    .content-wrapper .dash-stats .small-box {
        padding: 0.85rem 0.8rem;
        gap: 0.6rem;
    }

    .small-box > .icon,
    .content-wrapper .dash-stats .small-box > .icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .small-box .icon > i,
    .content-wrapper .dash-stats .small-box .icon > i {
        font-size: 15px !important;
    }

    .small-box .inner h3,
    .content-wrapper .dash-stats .small-box .inner h3 {
        font-size: 1.15rem;
    }

    .small-box .inner p,
    .content-wrapper .dash-stats .small-box .inner p {
        font-size: 0.72rem;
    }

    .content-wrapper > .content > .container-fluid,
    .content-header > .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}
