/* ==========================================================================
   VidPulse — Premium iOS / Linear / Stripe Inspired SaaS Design System
   ========================================================================== */

:root {
    --vp-bg: #F6F7FB;
    --vp-surface: #FFFFFF;
    --vp-text: #172033;
    --vp-text-muted: #8992A5;
    --vp-border: #EAECF2;
    --vp-primary: #635BFF;
    --vp-primary-hover: #5249F5;
    --vp-primary-soft: rgba(99, 91, 255, 0.10);

    --vp-success: #16A34A;
    --vp-success-soft: #ECFDF3;
    --vp-warning: #D97706;
    --vp-warning-soft: #FEF3C7;
    --vp-danger: #DC2626;
    --vp-danger-soft: #FEF2F2;
    --vp-info: #0284C7;
    --vp-info-soft: #E0F2FE;

    --vp-radius: 18px;
    --vp-radius-sm: 12px;
    --vp-shadow: 0 2px 14px rgba(23, 32, 51, 0.035);
    --vp-shadow-hover: 0 8px 24px rgba(23, 32, 51, 0.06);
    --vp-sidebar-width: 244px;
    --vp-topbar-height: 68px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--vp-bg);
    color: var(--vp-text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Auth Pages */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--vp-bg);
}

.auth-wrapper {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--vp-surface);
    border: 1px solid var(--vp-border);
    border-radius: 20px;
    padding: 36px 32px;
    box-shadow: 0 12px 36px rgba(23, 32, 51, 0.05);
}

.auth-logo {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--vp-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* App Shell Layout */
.app-shell {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Desktop Sidebar */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--vp-sidebar-width);
    background: var(--vp-surface);
    border-right: 1px solid var(--vp-border);
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    z-index: 1030;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 10px 20px;
    text-decoration: none;
    color: var(--vp-text);
}

.sidebar-brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: var(--vp-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-brand-name {
    font-weight: 700;
    font-size: 16px;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.sidebar-brand-sub {
    font-size: 11px;
    color: var(--vp-text-muted);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    color: #545F75;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-link i {
    font-size: 17px;
    width: 20px;
    text-align: center;
}

.sidebar-link:hover {
    background-color: #F3F4F8;
    color: var(--vp-text);
}

.sidebar-link.active {
    background-color: var(--vp-primary-soft);
    color: var(--vp-primary);
    font-weight: 600;
}

.sidebar-footer {
    border-top: 1px solid var(--vp-border);
    padding-top: 14px;
    margin-top: 12px;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--vp-primary-soft);
    color: var(--vp-primary);
    font-weight: 700;
    font-size: 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Main Content Area */
.app-main {
    margin-left: var(--vp-sidebar-width);
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Sticky Topbar */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    height: var(--vp-topbar-height);
    background: rgba(246, 247, 251, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--vp-border);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
}

.topbar-date {
    font-size: 12px;
    color: var(--vp-text-muted);
}

.app-content {
    padding: 24px 28px 40px;
    flex: 1;
}

/* Premium Cards */
.vp-card {
    background: var(--vp-surface);
    border: 1px solid var(--vp-border);
    border-radius: var(--vp-radius);
    box-shadow: var(--vp-shadow);
    padding: 22px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.vp-card-hover:hover {
    box-shadow: var(--vp-shadow-hover);
    transform: translateY(-1px);
}

.kpi-card {
    background: var(--vp-surface);
    border: 1px solid var(--vp-border);
    border-radius: var(--vp-radius);
    box-shadow: var(--vp-shadow);
    padding: 20px 22px;
    height: 100%;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.kpi-card:hover {
    box-shadow: var(--vp-shadow-hover);
    transform: translateY(-1px);
}

.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--vp-text);
    line-height: 1.25;
}

.kpi-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--vp-text-muted);
}

.kpi-sub {
    font-size: 12px;
    color: var(--vp-text-muted);
}

/* Soft Badges */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

.badge-soft-success { background: var(--vp-success-soft); color: var(--vp-success); }
.badge-soft-warning { background: var(--vp-warning-soft); color: var(--vp-warning); }
.badge-soft-danger  { background: var(--vp-danger-soft);  color: var(--vp-danger); }
.badge-soft-info    { background: var(--vp-info-soft);    color: var(--vp-info); }
.badge-soft-primary { background: var(--vp-primary-soft); color: var(--vp-primary); }
.badge-soft-neutral { background: #F1F3F8; color: #545F75; }

/* Buttons & Inputs */
.btn-primary {
    background-color: var(--vp-primary);
    border-color: var(--vp-primary);
    border-radius: 12px;
    font-weight: 500;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--vp-primary-hover);
    border-color: var(--vp-primary-hover);
}

.btn-light-soft {
    background-color: #FFFFFF;
    border: 1px solid var(--vp-border);
    color: var(--vp-text);
    border-radius: 12px;
    font-weight: 500;
}

.btn-light-soft:hover {
    background-color: #F3F4F8;
    border-color: #D8DCE6;
}

.form-control, .form-select {
    border-radius: 12px;
    border-color: #E2E6EF;
    font-size: 14px;
    padding: 9px 13px;
    color: var(--vp-text);
}

.form-control:focus, .form-select:focus {
    border-color: var(--vp-primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.12);
}

/* Segmented Date Pills */
.date-pill-group {
    display: inline-flex;
    background: #FFFFFF;
    border: 1px solid var(--vp-border);
    border-radius: 14px;
    padding: 4px;
    gap: 4px;
    flex-wrap: wrap;
}

.date-pill {
    border: none;
    background: transparent;
    color: #545F75;
    font-size: 13px;
    font-weight: 500;
    padding: 7px 13px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.date-pill:hover {
    color: var(--vp-text);
    background: #F4F5F9;
}

.date-pill.active {
    background: var(--vp-primary);
    color: #FFFFFF;
    font-weight: 600;
}

/* Premium Tables */
.vp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.vp-table thead th {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--vp-text-muted);
    padding: 12px 16px;
    border-bottom: 1px solid var(--vp-border);
    background: #FAFBFD;
    white-space: nowrap;
}

.vp-table thead th:first-child { border-top-left-radius: 12px; }
.vp-table thead th:last-child  { border-top-right-radius: 12px; }

.vp-table tbody td {
    padding: 14px 16px;
    font-size: 14px;
    border-bottom: 1px solid #F1F3F8;
    vertical-align: middle;
}

.vp-table tbody tr:last-child td {
    border-bottom: none;
}

.vp-table tbody tr {
    transition: background-color 0.12s ease;
}

.vp-table tbody tr:hover {
    background-color: #FAFBFD;
}

.sortable-th {
    cursor: pointer;
    user-select: none;
}

.sortable-th:hover {
    color: var(--vp-primary);
}

/* Progress Bar for Video Balance */
.usage-progress {
    height: 7px;
    border-radius: 999px;
    background: #EEF0F6;
    overflow: hidden;
    min-width: 90px;
}

.usage-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.3s ease;
}

.usage-normal   { background-color: #16A34A; }
.usage-moderate { background-color: #D97706; }
.usage-high     { background-color: #EA580C; }
.usage-full     { background-color: #DC2626; }

/* Timeline */
.timeline-list {
    position: relative;
    padding-left: 22px;
}

.timeline-list::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 6px;
    bottom: 6px;
    width: 2px;
    background: #EAECF2;
}

.timeline-item {
    position: relative;
    padding-bottom: 16px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -21px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #FFFFFF;
    box-shadow: 0 0 0 2px #EAECF2;
}

.timeline-dot.completed  { background: var(--vp-success); }
.timeline-dot.processing { background: var(--vp-warning); }
.timeline-dot.failed     { background: var(--vp-danger); }

/* Activity Feed */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #F1F3F8;
}

.activity-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.activity-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, #F0F2F7 25%, #E6E9F2 50%, #F0F2F7 75%);
    background-size: 200% 100%;
    animation: vp-shimmer 1.3s infinite;
    border-radius: 8px;
}

@keyframes vp-shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
}

.empty-state-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: #F3F4F8;
    color: var(--vp-text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 14px;
}

/* Mobile Bottom Nav & Drawer (hidden on desktop) */
.mobile-bottom-nav {
    display: none;
}

.mobile-card-item {
    background: var(--vp-surface);
    border: 1px solid var(--vp-border);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--vp-shadow);
}

/* Active Filter Chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--vp-primary-soft);
    color: var(--vp-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 999px;
}

.filter-chip button {
    border: none;
    background: none;
    color: inherit;
    padding: 0;
    line-height: 1;
    cursor: pointer;
}

/* Chart Containers */
.chart-box {
    position: relative;
    width: 100%;
    height: 290px;
}

.chart-box-sm {
    position: relative;
    width: 100%;
    height: 220px;
}
