/* =========================================================================
   MerdLive - Modern Theme
   Upgrade: Bootstrap 3 → Bootstrap 5.3 + Custom Components
   ========================================================================= */

:root {
    /* Brand palette — MerdLive Sky Blue */
    --mp-primary: #0EA5E9;
    --mp-primary-dark: #0284C7;
    --mp-primary-light: #E0F2FE;
    --mp-primary-rgb: 14, 165, 233;

    /* Status colors */
    --mp-success: #10B981;
    --mp-success-light: #D1FAE5;
    --mp-danger: #EF4444;
    --mp-danger-light: #FEE2E2;
    --mp-warning: #F59E0B;
    --mp-warning-light: #FEF3C7;
    --mp-info: #38BDF8;
    --mp-info-light: #E0F2FE;

    /* Platform brand colors */
    --mp-google: #4285F4;
    --mp-google-bg: #E8F0FE;
    --mp-facebook: #1877F2;
    --mp-facebook-bg: #E7F3FF;
    --mp-line: #06C755;
    --mp-line-bg: #E4F8ED;

    /* Surface colors */
    --mp-bg: #F8FAFC;
    --mp-surface: #FFFFFF;
    --mp-surface-alt: #F1F5F9;
    --mp-border: #E2E8F0;
    --mp-border-strong: #CBD5E1;

    /* Text colors */
    --mp-text: #0F172A;
    --mp-text-muted: #64748B;
    --mp-text-light: #94A3B8;

    /* Shadows */
    --mp-shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, .05);
    --mp-shadow: 0 1px 3px 0 rgba(15, 23, 42, .08), 0 1px 2px -1px rgba(15, 23, 42, .04);
    --mp-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .05);
    --mp-shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, .10), 0 4px 6px -4px rgba(15, 23, 42, .05);
    --mp-shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, .10), 0 8px 10px -6px rgba(15, 23, 42, .05);

    /* Radius */
    --mp-radius-sm: .375rem;
    --mp-radius: .5rem;
    --mp-radius-lg: .75rem;
    --mp-radius-xl: 1rem;

    /* Typography */
    --mp-font-display: 'Prompt', 'Segoe UI', system-ui, sans-serif;
    --mp-font-body: 'Sarabun', 'Segoe UI', system-ui, sans-serif;
}

/* =========================================================================
   Base
   ========================================================================= */
* { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

html, body {
    font-family: var(--mp-font-body);
    font-size: 15px;
    color: var(--mp-text);
    background: var(--mp-bg);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6, .mp-display {
    font-family: var(--mp-font-display);
    font-weight: 600;
    color: var(--mp-text);
    letter-spacing: -0.01em;
}

a { color: var(--mp-primary); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--mp-primary-dark); }

/* Subtle gradient background accent */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(220, 38, 38, .08), transparent 60%),
        radial-gradient(ellipse 60% 50% at 100% 0%, rgba(14, 165, 233, .06), transparent 60%);
    pointer-events: none;
    z-index: -1;
}

/* =========================================================================
   Navbar
   ========================================================================= */
.mp-navbar {
    background: #1E293B;
    border-bottom: 1px solid rgba(255,255,255,.08);
    box-shadow: 0 1px 3px rgba(0,0,0,.3);
}

.mp-navbar .navbar-brand {
    font-family: var(--mp-font-display);
    font-weight: 700;
    font-size: 1.25rem;
    color: #FFFFFF !important;
    display: flex;
    align-items: center;
    gap: .5rem;
    letter-spacing: -0.02em;
}

.mp-navbar .navbar-brand .brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--mp-primary), #0369A1);
    border-radius: var(--mp-radius);
    color: white;
    font-size: 1rem;
    box-shadow: var(--mp-shadow-md);
}

.mp-navbar .text-muted {
    color: rgba(255,255,255,.45) !important;
}

.mp-navbar .nav-link {
    color: rgba(255,255,255,.75) !important;
    font-weight: 500;
    padding: .5rem .875rem !important;
    border-radius: var(--mp-radius);
    transition: all .15s ease;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
}

.mp-navbar .nav-link:hover {
    color: #FFFFFF !important;
    background: rgba(255,255,255,.12);
}

.mp-navbar .nav-link.logout {
    color: rgba(248,113,113,.9) !important;
}

.mp-navbar .nav-link.logout:hover {
    background: rgba(239,68,68,.2);
    color: #FCA5A5 !important;
}

/* Badge ใน navbar (Admin/Sale) */
.mp-navbar .mp-badge {
    background: rgba(255,255,255,.12);
    color: rgba(255,255,255,.85);
}
.mp-navbar .mp-muted {
    color: rgba(255,255,255,.55) !important;
}
/* Toggle hamburger บน mobile */
.mp-navbar .navbar-toggler {
    border-color: rgba(255,255,255,.25);
}
.mp-navbar .navbar-toggler-icon {
    filter: invert(1);
}

/* =========================================================================
   Main container
   ========================================================================= */
.mp-main {
    padding-top: 90px;
    padding-bottom: 3rem;
    min-height: calc(100vh - 60px);
}

/* =========================================================================
   Cards
   ========================================================================= */
.mp-card {
    background: var(--mp-surface);
    border: 1px solid var(--mp-border);
    border-radius: var(--mp-radius-lg);
    box-shadow: var(--mp-shadow-sm);
    overflow: hidden;
    transition: box-shadow .2s ease, transform .2s ease;
}

.mp-card:hover {
    box-shadow: var(--mp-shadow-md);
}

.mp-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--mp-border);
    background: var(--mp-surface);
    font-family: var(--mp-font-display);
    font-weight: 600;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.mp-card-body { padding: 1.25rem; }

.mp-card-body > *:last-child { margin-bottom: 0; }

/* =========================================================================
   Stat Cards (KPI)
   ========================================================================= */
.mp-stat {
    background: var(--mp-surface);
    border: 1px solid var(--mp-border);
    border-radius: var(--mp-radius-lg);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease;
}

.mp-stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--mp-shadow-md);
}

.mp-stat::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--mp-primary);
    opacity: .8;
}

.mp-stat.stat-success::before { background: var(--mp-success); }
.mp-stat.stat-warning::before { background: var(--mp-warning); }
.mp-stat.stat-danger::before { background: var(--mp-danger); }
.mp-stat.stat-info::before { background: var(--mp-info); }

.mp-stat-label {
    font-size: .8125rem;
    color: var(--mp-text-muted);
    font-weight: 500;
    margin-bottom: .375rem;
    display: flex;
    align-items: center;
    gap: .375rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mp-stat-value {
    font-family: var(--mp-font-display);
    font-size: 1.65rem;
    font-weight: 700;
    color: var(--mp-text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.mp-stat-value.value-success { color: var(--mp-success); }
.mp-stat-value.value-danger { color: var(--mp-danger); }
.mp-stat-value.value-primary { color: var(--mp-primary); }

.mp-stat-sub {
    font-size: .8125rem;
    color: var(--mp-text-muted);
    margin-top: .25rem;
}

/* =========================================================================
   Status Badge
   ========================================================================= */
.mp-badge {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .35rem .75rem;
    font-size: .8125rem;
    font-weight: 600;
    border-radius: 999px;
    line-height: 1;
}

.mp-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.mp-badge.badge-success { background: var(--mp-success-light); color: #047857; }
.mp-badge.badge-danger  { background: var(--mp-danger-light);  color: #B91C1C; }
.mp-badge.badge-warning { background: var(--mp-warning-light); color: #B45309; }
.mp-badge.badge-info    { background: var(--mp-info-light);    color: #0369A1; }
.mp-badge.badge-muted   { background: var(--mp-surface-alt);   color: var(--mp-text-muted); }

.mp-badge-platform {
    display: inline-flex;
    align-items: center;
    gap: .375rem;
    padding: .35rem .7rem;
    font-size: .8125rem;
    font-weight: 600;
    border-radius: var(--mp-radius);
}

.mp-badge-platform.platform-google   { background: var(--mp-google-bg);   color: var(--mp-google);   }
.mp-badge-platform.platform-facebook { background: var(--mp-facebook-bg); color: var(--mp-facebook); }
.mp-badge-platform.platform-line     { background: var(--mp-line-bg);     color: var(--mp-line);     }

/* =========================================================================
   Ad Item Card (dashboard)
   ========================================================================= */
.mp-ad-item {
    background: var(--mp-surface);
    border: 1px solid var(--mp-border);
    border-radius: var(--mp-radius-lg);
    padding: 0;
    margin-bottom: 1rem;
    overflow: hidden;
    transition: box-shadow .2s ease;
}

.mp-ad-item:hover { box-shadow: var(--mp-shadow-md); }

.mp-ad-item-body {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    gap: 0;
}

@media (max-width: 991.98px) {
    .mp-ad-item-body {
        grid-template-columns: 1fr 1fr;
    }
    .mp-ad-item-body > *:first-child {
        grid-column: 1 / -1;
    }
}

.mp-ad-cell {
    padding: 1.125rem 1.25rem;
    border-right: 1px solid var(--mp-border);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mp-ad-cell:last-child { border-right: none; }

@media (max-width: 991.98px) {
    .mp-ad-cell { border-right: none; border-bottom: 1px solid var(--mp-border); }
    .mp-ad-cell:last-child { border-bottom: none; }
}

.mp-ad-cell.cell-info {
    background: linear-gradient(135deg, rgba(220, 38, 38, .02), rgba(14, 165, 233, .02));
}

.mp-ad-topic {
    font-family: var(--mp-font-display);
    font-weight: 600;
    font-size: 1rem;
    color: var(--mp-primary);
    margin-bottom: .25rem;
}

.mp-ad-desc {
    font-size: .9rem;
    color: var(--mp-text);
    margin-bottom: .125rem;
    line-height: 1.45;
}

.mp-ad-url {
    font-size: .85rem;
    color: var(--mp-success);
    font-weight: 500;
    word-break: break-all;
}

.mp-ad-metric-label {
    font-size: .75rem;
    color: var(--mp-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: .5rem;
}

.mp-ad-metric-value {
    font-family: var(--mp-font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mp-text);
    letter-spacing: -0.02em;
    line-height: 1;
}

.mp-ad-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    background: var(--mp-surface-alt);
    border-top: 1px solid var(--mp-border);
    font-size: .875rem;
}

@media (max-width: 575.98px) {
    .mp-ad-footer { grid-template-columns: 1fr; }
}

.mp-ad-footer > div {
    padding: .75rem 1.25rem;
    color: var(--mp-text-muted);
    display: flex;
    align-items: center;
    gap: .5rem;
}

.mp-ad-footer > div:first-child { border-right: 1px solid var(--mp-border); }

.mp-ad-footer > div strong { color: var(--mp-text); font-weight: 600; }

/* Total row */
.mp-ad-item.is-total {
    background: linear-gradient(135deg, var(--mp-primary), #0369A1);
    border: none;
    color: white;
    margin-top: 1.5rem;
}

.mp-ad-item.is-total .mp-ad-cell {
    border-color: rgba(255, 255, 255, .15);
}

.mp-ad-item.is-total .mp-ad-topic,
.mp-ad-item.is-total .mp-ad-metric-value { color: white; }

.mp-ad-item.is-total .mp-ad-metric-label { color: rgba(255, 255, 255, .75); }

/* =========================================================================
   Tables
   ========================================================================= */
.mp-table-wrapper {
    background: var(--mp-surface);
    border: 1px solid var(--mp-border);
    border-radius: var(--mp-radius-lg);
    overflow: hidden;
    box-shadow: var(--mp-shadow-sm);
}

.mp-table-scroll { overflow-x: auto; }

.mp-table,
.mp-table-wrapper table.GridView {
    width: 100% !important;
    margin: 0 !important;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .875rem;
}

.mp-table-wrapper table.GridView th,
.mp-table-wrapper table.GridView tr:first-child td {
    background: var(--mp-surface-alt) !important;
    color: var(--mp-text-muted) !important;
    font-weight: 600 !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: .75rem !important;
    padding: .85rem 1rem !important;
    text-align: left !important;
    border: none !important;
    border-bottom: 1px solid var(--mp-border) !important;
    white-space: nowrap;
}

.mp-table-wrapper table.GridView td {
    padding: .85rem 1rem !important;
    border: none !important;
    border-bottom: 1px solid var(--mp-border) !important;
    vertical-align: middle !important;
    color: var(--mp-text) !important;
    background: var(--mp-surface) !important;
    font-size: .875rem !important;
}

.mp-table-wrapper table.GridView tr:last-child td {
    border-bottom: none !important;
}

.mp-table-wrapper table.GridView tr:hover td {
    background: var(--mp-primary-light) !important;
}

.mp-table-wrapper table.GridView td span[style*="Green"],
.mp-table-wrapper table.GridView td span[style*="green"] {
    color: var(--mp-success) !important;
    font-weight: 600;
}

.mp-table-wrapper table.GridView td span[style*="Red"],
.mp-table-wrapper table.GridView td span[style*="red"] {
    color: var(--mp-danger) !important;
    font-weight: 600;
}

/* Icon action buttons in tables (edit / del) */
.mp-table-wrapper td a img {
    width: 18px; height: 18px;
    opacity: .6;
    transition: opacity .15s ease, transform .15s ease;
}

.mp-table-wrapper td a:hover img {
    opacity: 1;
    transform: scale(1.1);
}

/* =========================================================================
   Forms
   ========================================================================= */
.mp-form-label {
    font-size: .875rem;
    font-weight: 500;
    color: var(--mp-text);
    margin-bottom: .4rem;
    display: block;
}

.mp-form-control,
input.form-control,
select.form-control,
textarea.form-control,
input[type="text"].form-control,
input[type="password"].form-control {
    display: block;
    width: 100%;
    padding: .6rem .85rem;
    font-family: var(--mp-font-body);
    font-size: .95rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--mp-text);
    background: var(--mp-surface);
    border: 1px solid var(--mp-border-strong);
    border-radius: var(--mp-radius);
    transition: border-color .15s ease, box-shadow .15s ease;
    box-shadow: var(--mp-shadow-sm);
}

.mp-form-control:focus,
input.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
    outline: 0;
    border-color: var(--mp-primary);
    box-shadow: 0 0 0 3px rgba(var(--mp-primary-rgb), .15);
}

.mp-form-control:disabled,
input.form-control:disabled,
input.form-control[disabled] {
    background: var(--mp-surface-alt);
    color: var(--mp-text-muted);
    cursor: not-allowed;
}

textarea.form-control { min-height: 96px; resize: vertical; }

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748B' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .85rem center;
    padding-right: 2.25rem;
    appearance: none;
    -webkit-appearance: none;
}

/* Radio buttons */
.mp-radio-group label {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    margin-right: 1.25rem;
    font-size: .9rem;
    cursor: pointer;
}

.mp-radio-group input[type="radio"] {
    accent-color: var(--mp-primary);
    width: 1rem;
    height: 1rem;
}

/* File upload */
input[type="file"].form-control {
    padding: .45rem .6rem;
    font-size: .875rem;
}

input[type="file"].form-control::-webkit-file-upload-button {
    background: var(--mp-primary-light);
    color: var(--mp-primary);
    border: none;
    padding: .35rem .85rem;
    border-radius: var(--mp-radius-sm);
    font-family: var(--mp-font-body);
    font-weight: 500;
    margin-right: .75rem;
    cursor: pointer;
    transition: background .15s ease;
}

input[type="file"].form-control::-webkit-file-upload-button:hover {
    background: var(--mp-primary);
    color: white;
}

/* =========================================================================
   Buttons (overriding Bootstrap 5 + supporting default asp:Button)
   ========================================================================= */
.mp-btn,
input[type="submit"].btn,
input[type="button"].btn,
button.btn,
a.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1.15rem;
    font-family: var(--mp-font-body);
    font-size: .9rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--mp-radius);
    cursor: pointer;
    transition: all .15s ease;
    text-decoration: none;
    line-height: 1.5;
    letter-spacing: 0;
}

.btn-primary,
input[type="submit"].btn-primary {
    background: var(--mp-primary) !important;
    border-color: var(--mp-primary) !important;
    color: white !important;
    box-shadow: 0 1px 2px rgba(var(--mp-primary-rgb), .3);
}

.btn-primary:hover,
input[type="submit"].btn-primary:hover {
    background: var(--mp-primary-dark) !important;
    border-color: var(--mp-primary-dark) !important;
    box-shadow: 0 4px 10px rgba(var(--mp-primary-rgb), .35);
    transform: translateY(-1px);
}

.btn-success,
input[type="submit"].btn-success {
    background: var(--mp-success) !important;
    border-color: var(--mp-success) !important;
    color: white !important;
}

.btn-success:hover,
input[type="submit"].btn-success:hover {
    background: #059669 !important;
    border-color: #059669 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(16, 185, 129, .35);
}

.btn-danger,
input[type="submit"].btn-danger {
    background: var(--mp-danger) !important;
    border-color: var(--mp-danger) !important;
    color: white !important;
}

.btn-danger:hover,
input[type="submit"].btn-danger:hover {
    background: #DC2626 !important;
    border-color: #DC2626 !important;
}

.btn-default,
.btn-secondary,
input[type="submit"].btn-default,
input[type="button"].btn-default {
    background: var(--mp-surface) !important;
    border-color: var(--mp-border-strong) !important;
    color: var(--mp-text) !important;
}

.btn-default:hover,
.btn-secondary:hover,
input[type="submit"].btn-default:hover {
    background: var(--mp-surface-alt) !important;
    border-color: var(--mp-text-muted) !important;
}

/* Legacy asp:Button without CssClass - prettify default Windows look */
input[type="submit"]:not(.btn):not([class*="btn-"]),
input[type="button"]:not(.btn):not([class*="btn-"]) {
    display: inline-flex;
    align-items: center;
    padding: .5rem 1rem;
    background: var(--mp-primary);
    color: white;
    border: none;
    border-radius: var(--mp-radius);
    font-family: var(--mp-font-body);
    font-weight: 600;
    font-size: .875rem;
    cursor: pointer;
    transition: all .15s ease;
    margin-right: .35rem;
    box-shadow: var(--mp-shadow-sm);
}

input[type="submit"]:not(.btn):not([class*="btn-"]):hover,
input[type="button"]:not(.btn):not([class*="btn-"]):hover {
    background: var(--mp-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--mp-shadow-md);
}

/* =========================================================================
   Page Header
   ========================================================================= */
.mp-page-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.mp-page-title {
    font-family: var(--mp-font-display);
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.02em;
}

.mp-page-subtitle {
    color: var(--mp-text-muted);
    font-size: .95rem;
    margin-top: .25rem;
}

/* =========================================================================
   Empty states / Alerts
   ========================================================================= */
.mp-alert {
    padding: 1rem 1.25rem;
    border-radius: var(--mp-radius);
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: .75rem;
}

.mp-alert-danger {
    background: var(--mp-danger-light);
    border-color: rgba(239, 68, 68, .3);
    color: #0369A1;
}

.mp-alert-success {
    background: var(--mp-success-light);
    border-color: rgba(16, 185, 129, .3);
    color: #065F46;
}

/* =========================================================================
   Footer
   ========================================================================= */
.mp-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--mp-border);
    text-align: center;
    color: var(--mp-text-muted);
    font-size: .875rem;
}

.mp-footer strong { color: var(--mp-text); font-weight: 600; }

.mp-footer-contact {
    display: inline-flex;
    align-items: center;
    gap: 1.25rem;
    margin-top: .5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mp-footer-contact a {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    color: var(--mp-text-muted);
    font-weight: 500;
}

.mp-footer-contact a:hover { color: var(--mp-primary); }

/* =========================================================================
   Login Page
   ========================================================================= */
.mp-login-wrap {
    min-height: calc(100vh - 140px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.mp-login-card {
    width: 100%;
    max-width: 440px;
    background: var(--mp-surface);
    border-radius: var(--mp-radius-xl);
    box-shadow: var(--mp-shadow-xl);
    overflow: hidden;
    border: 1px solid var(--mp-border);
}

.mp-login-header {
    padding: 2rem 2rem 1.25rem;
    text-align: center;
    background: linear-gradient(135deg, var(--mp-primary), #0369A1);
    color: white;
    position: relative;
    overflow: hidden;
}

.mp-login-header::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(255,255,255,.2), transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(255,255,255,.1), transparent 40%);
    pointer-events: none;
}

.mp-login-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, .2);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    margin-bottom: .75rem;
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, .25);
}

.mp-login-title {
    font-family: var(--mp-font-display);
    font-weight: 700;
    font-size: 1.375rem;
    margin: 0;
    color: white;
    position: relative;
}

.mp-login-subtitle {
    font-size: .875rem;
    margin-top: .35rem;
    opacity: .9;
    position: relative;
}

.mp-login-body { padding: 2rem; }

/* =========================================================================
   Panels (old Bootstrap 3 compat for legacy markup still in code-behind)
   ========================================================================= */
.panel, .panel-default, .panel-primary {
    border: 1px solid var(--mp-border) !important;
    border-radius: var(--mp-radius-lg) !important;
    background: var(--mp-surface) !important;
    box-shadow: var(--mp-shadow-sm);
    margin-bottom: 1rem;
    overflow: hidden;
}

.panel-heading {
    background: var(--mp-surface) !important;
    border-bottom: 1px solid var(--mp-border) !important;
    padding: .85rem 1.1rem !important;
    color: var(--mp-text) !important;
    font-weight: 500;
    border-radius: 0 !important;
    font-size: .9rem;
}

.panel-primary .panel-heading {
    background: linear-gradient(135deg, var(--mp-primary), #0369A1) !important;
    color: white !important;
    border-color: var(--mp-primary) !important;
}

.panel-body { padding: 1.1rem !important; }

/* =========================================================================
   Utility
   ========================================================================= */
.mp-divider { height: 1px; background: var(--mp-border); margin: 1.5rem 0; }

.mp-muted { color: var(--mp-text-muted); }

.mp-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.mp-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.mp-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 991.98px) {
    .mp-grid-3, .mp-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 575.98px) {
    .mp-grid-2, .mp-grid-3, .mp-grid-4 { grid-template-columns: 1fr; }
    .mp-page-title { font-size: 1.35rem; }
}

/* Small utility link for "add new" */
.mp-add-link {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .5rem 1rem;
    background: var(--mp-primary);
    color: white !important;
    border-radius: var(--mp-radius);
    font-weight: 600;
    font-size: .875rem;
    transition: all .15s ease;
    box-shadow: 0 1px 2px rgba(var(--mp-primary-rgb), .3);
}

.mp-add-link:hover {
    background: var(--mp-primary-dark);
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(var(--mp-primary-rgb), .35);
}

.mp-add-link i, .mp-add-link .bi { font-size: 1rem; }

/* Image preview in AdsEdit */
.mp-img-preview {
    border: 2px dashed var(--mp-border-strong);
    border-radius: var(--mp-radius-lg);
    padding: 1rem;
    background: var(--mp-surface-alt);
    display: inline-block;
}

.mp-img-preview img {
    max-width: 100%;
    height: auto !important;
    max-height: 350px;
    border-radius: var(--mp-radius);
    display: block;
}

/* Fade in animation on page load */
@keyframes mpFadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.mp-card, .mp-stat, .mp-ad-item, .mp-login-card, .mp-table-wrapper {
    animation: mpFadeInUp .35s ease-out backwards;
}

.mp-stat:nth-child(1) { animation-delay: .05s; }
.mp-stat:nth-child(2) { animation-delay: .10s; }
.mp-stat:nth-child(3) { animation-delay: .15s; }
.mp-stat:nth-child(4) { animation-delay: .20s; }


/* =========================================================================
   Schedule Builder (Google Ads-style)
   ========================================================================= */
.mp-schedule-builder {
    background: var(--mp-surface-alt);
    border: 1px solid var(--mp-border);
    border-radius: var(--mp-radius-lg);
    padding: .85rem;
}

.mp-sched-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .5rem;
    flex-wrap: wrap;
}

.mp-sched-row:last-of-type { margin-bottom: .25rem; }

.mp-sched-row .sched-days {
    flex: 0 0 180px;
    max-width: 180px;
    padding: .45rem .7rem;
    font-family: var(--mp-font-body);
    font-size: .9rem;
    color: var(--mp-text);
    background: var(--mp-surface);
    border: 1px solid var(--mp-border-strong);
    border-radius: var(--mp-radius);
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748B' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2rem;
    appearance: none;
    -webkit-appearance: none;
}

.mp-sched-row .sched-start,
.mp-sched-row .sched-end {
    flex: 0 0 110px;
    max-width: 110px;
    padding: .45rem .7rem;
    font-family: var(--mp-font-body);
    font-size: .9rem;
    color: var(--mp-text);
    background: var(--mp-surface);
    border: 1px solid var(--mp-border-strong);
    border-radius: var(--mp-radius);
    text-align: center;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.mp-sched-row .sched-days:focus,
.mp-sched-row .sched-start:focus,
.mp-sched-row .sched-end:focus {
    outline: 0;
    border-color: var(--mp-primary);
    box-shadow: 0 0 0 3px rgba(var(--mp-primary-rgb), .15);
}

.mp-sched-sep {
    color: var(--mp-text-muted);
    font-size: .88rem;
}

.mp-sched-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border: none;
    background: transparent;
    color: var(--mp-text-muted);
    border-radius: var(--mp-radius);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.mp-sched-remove:hover {
    background: var(--mp-danger-light);
    color: var(--mp-danger);
}

.mp-schedule-add {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .4rem .85rem;
    margin-top: .5rem;
    background: transparent;
    border: none;
    color: var(--mp-primary);
    font-family: var(--mp-font-body);
    font-weight: 600;
    font-size: .9rem;
    cursor: pointer;
    border-radius: var(--mp-radius);
    transition: background .15s ease;
}

.mp-schedule-add:hover {
    background: var(--mp-primary-light);
}

@media (max-width: 575.98px) {
    .mp-sched-row .sched-days {
        flex: 1 1 100%;
        max-width: 100%;
    }
    .mp-sched-row .sched-start,
    .mp-sched-row .sched-end {
        flex: 1 1 calc(50% - 1rem);
    }
}


/* =========================================================================
   Google Search Result Card (AdsCus)
   ========================================================================= */
.mp-gscard {
    background: var(--mp-surface);
    border: 1px solid var(--mp-border);
    border-radius: var(--mp-radius-lg);
    overflow: hidden;
    margin-bottom: .85rem;
    transition: box-shadow .2s ease;
    animation: mpFadeInUp .3s ease-out backwards;
}
.mp-gscard:hover { box-shadow: var(--mp-shadow-md); }

.mp-gscard-inner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem .75rem;
}

.mp-gscard-content { flex: 1 1 auto; min-width: 0; }

/* brand row */
.mp-gscard-brand {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: .35rem;
}
.mp-gscard-favicon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px; height: 26px;
    background: var(--mp-surface-alt);
    border-radius: 50%;
    font-size: .8rem;
    color: var(--mp-text-muted);
    flex-shrink: 0;
}
.mp-gscard-domain {
    font-size: .85rem;
    color: var(--mp-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* headline */
.mp-gscard-title {
    font-family: var(--mp-font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: #1a0dab;
    line-height: 1.35;
    margin-bottom: .25rem;
    cursor: default;
}
.mp-gscard-title:hover { text-decoration: underline; }

/* description */
.mp-gscard-desc {
    font-size: .9rem;
    color: var(--mp-text);
    line-height: 1.5;
}

/* thumbnail */
.mp-gscard-thumb {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

/* metrics row */
.mp-gscard-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem 1.25rem;
    padding: .6rem 1.25rem .75rem;
    background: var(--mp-surface-alt);
    border-top: 1px solid var(--mp-border);
}
.mp-gscard-metric {
    display: flex;
    align-items: center;
    gap: .4rem;
}
.mp-gscard-metric--wide { flex: 1 1 auto; }
.mp-gscard-metric .mp-ad-metric-label {
    font-size: .75rem;
    color: var(--mp-text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 500;
    flex-shrink: 0;
}
.mp-gscard-metric .mp-ad-metric-value {
    font-family: var(--mp-font-display);
    font-size: 1rem;
    font-weight: 700;
    color: var(--mp-text);
    letter-spacing: -.01em;
}

/* Total row */
.mp-gscard-total {
    background: linear-gradient(135deg, var(--mp-primary), #0369A1);
    border: none;
}
.mp-gscard-total .mp-gscard-metrics {
    background: transparent;
    border-top: 1px solid rgba(255,255,255,.15);
}

@media (max-width: 575.98px) {
    .mp-gscard-inner { flex-direction: column-reverse; }
    .mp-gscard-thumb img { width: 100% !important; height: 160px !important; border-radius: var(--mp-radius); }
    .mp-gscard-title { font-size: 1rem; }
}


/* =========================================================================
   Drop Zone (AdsEdit image upload)
   ========================================================================= */
.mp-drop-zone img.has-image + .mp-drop-placeholder { opacity: 0 !important; }


/* =========================================================================
   Google Search Card v2 — domain / https / headline-detail1 / desc
   image + metrics on right
   ========================================================================= */

/* brand row */
.mp-gscard-brand-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .85rem 1.25rem .35rem;
}
.mp-gscard-brand-text { display: flex; flex-direction: column; gap: .05rem; min-width: 0; }
.mp-gscard-domain     { font-size: .92rem; color: var(--mp-text); font-weight: 500; }
.mp-gscard-url-line   { font-size: .8rem; color: var(--mp-text-muted); }

/* body: text LEFT + side RIGHT */
.mp-gscard-body {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: .35rem 1.25rem .9rem;
}

/* text area (left) */
.mp-gscard-text { flex: 1 1 auto; min-width: 0; }

/* side (right): image + metrics stacked */
.mp-gscard-side {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: .55rem;
    min-width: 110px;
}

/* image */
.mp-gscard-img {
    width: 110px;
    height: 82px;
    object-fit: cover;
    border-radius: var(--mp-radius);
    display: block;
}

/* metrics stacked in right column */
.mp-gscard-metrics-side {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: .18rem;
    border-top: 1px solid var(--mp-border);
    padding-top: .4rem;
}
.mp-gscard-metric-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .4rem;
    font-size: .78rem;
}
.mp-met-label {
    color: var(--mp-text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.mp-met-val {
    font-family: var(--mp-font-display);
    font-weight: 700;
    color: var(--mp-text);
    font-size: .88rem;
}

/* meta row: time + area */
.mp-gscard-meta {
    margin-top: .45rem;
    display: flex;
    flex-wrap: wrap;
    gap: .5rem .9rem;
    font-size: .78rem;
    color: var(--mp-text-muted);
}
.mp-gscard-meta span { display: inline-flex; align-items: center; gap: .25rem; }

/* responsive */
@media (max-width: 575.98px) {
    /* mobile: text ซ้าย + รูปขวา เหมือน Google Ad บนมือถือ */
    .mp-gscard-body {
        flex-direction: row;
        align-items: flex-start;
        gap: .75rem;
    }
    .mp-gscard-text { flex: 1 1 auto; min-width: 0; }
    .mp-gscard-side {
        flex: 0 0 auto;
        flex-direction: column;
        align-items: flex-end;
        min-width: unset;
    }
    .mp-gscard-img {
        width: 100px;
        height: 80px;
        object-fit: cover;
        border-radius: var(--mp-radius);
    }
    .mp-gscard-metrics-side {
        width: 100px;
        font-size: .7rem;
    }
    /* metrics bar บนมือถือ */
    .mp-met-block-val   { font-size: 1rem; }
    .mp-met-block-label { font-size: .7rem; }
    .mp-met-block       { padding: .5rem .25rem; }
}


/* =========================================================================
   Metrics bar — full-width bottom row, larger text
   ========================================================================= */
.mp-gscard-metrics-bar {
    display: flex;
    align-items: stretch;
    background: var(--mp-surface-alt);
    border-top: 1px solid var(--mp-border);
    border-radius: 0 0 var(--mp-radius-lg) var(--mp-radius-lg);
}
.mp-met-block {
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: .75rem .5rem;
    gap: .2rem;
    text-align: center;
}
.mp-met-sep {
    width: 1px;
    background: var(--mp-border);
    margin: .5rem 0;
    flex-shrink: 0;
}
.mp-met-block-label {
    font-size: .8rem;
    color: var(--mp-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.mp-met-block-val {
    font-family: var(--mp-font-display);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--mp-text);
    line-height: 1;
    letter-spacing: -.02em;
}
@media (max-width: 575.98px) {
    .mp-met-block-val   { font-size: 1.1rem; }
    .mp-met-block-label { font-size: .72rem; }
    .mp-met-block       { padding: .6rem .3rem; }
}

@media (max-width: 575.98px) {
    .mp-gscard-brand-row  { padding: .65rem 1rem .25rem; }
    .mp-gscard-body       { padding: .25rem 1rem .75rem; }
    .mp-gscard-title      { font-size: 1rem; line-height: 1.3; }
    .mp-gscard-desc       { font-size: .85rem; }
    .mp-gscard-domain     { font-size: .82rem; }
    .mp-gscard-url-line   { font-size: .75rem; }
}

/* ============================================================
   Navbar Platform Dropdown
   ============================================================ */
.mp-nav-dropdown {
    background: #1E293B;
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 10px;
    padding: 6px;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

    .mp-nav-dropdown .dropdown-item.nav-plat-item {
        display: flex;
        align-items: center;
        gap: .55rem;
        padding: .5rem .75rem;
        border-radius: 6px;
        font-size: .88rem;
        font-weight: 600;
        color: rgba(255,255,255,.75);
        transition: background .15s;
    }

    .mp-nav-dropdown .nav-plat-item:hover {
        background: rgba(255,255,255,.1);
        color: #fff;
    }

    .mp-nav-dropdown .nav-plat-1 i {
        color: #4285F4;
    }

    .mp-nav-dropdown .nav-plat-2 i {
        color: #1877F2;
    }

    .mp-nav-dropdown .nav-plat-3 i {
        color: #06C755;
    }

    .mp-nav-dropdown .nav-plat-4 i {
        color: #C9C9C9;
    }

/* Hamburger icon — สีขาวบน dark navbar */
.navbar-toggler .bi-list {
    color: #ffffff !important;
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: none;
}