/* ============================================
   SIGAds - Global Styles
   ============================================ */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #0ea5e9;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --dark-2: #334155;
    --gray: #64748b;
    --gray-light: #94a3b8;
    --gray-lighter: #e2e8f0;
    --light: #f1f5f9;
    --white: #ffffff;
    --sidebar-icon-width: 64px;
    --sidebar-text-width: 240px;
    --topbar-height: 0px;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
    --transition: all .2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--dark);
    background: var(--light);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; height: auto; }

/* ============================================
   HOMEPAGE
   ============================================ */
.hp-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 40px; height: 72px;
    background: rgba(255,255,255,.92); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--gray-lighter);
}
.hp-nav .logo { font-size: 24px; font-weight: 800; color: var(--primary); letter-spacing: -.5px; }
.hp-nav .logo span { color: var(--dark); }
.hp-nav-links { display: flex; gap: 32px; align-items: center; }
.hp-nav-links a { color: var(--gray); font-weight: 500; font-size: 17px; transition: var(--transition); }
.hp-nav-links a:hover { color: var(--dark); }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 24px; border-radius: var(--radius);
    font-weight: 600; font-size: 16px; border: none; cursor: pointer;
    transition: var(--transition); text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--white); color: var(--dark); border: 1px solid var(--gray-lighter); }
.btn-secondary:hover { background: var(--light); color: var(--dark); border-color: var(--gray-light); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color: #fff; }
.btn-sm { padding: 6px 14px; font-size: 15px; }
.btn-lg { padding: 14px 32px; font-size: 18px; }
.btn-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

.hp-hero {
    padding: 140px 40px 80px;
    text-align: center;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 50%, #c7d2fe 100%);
    position: relative; overflow: hidden;
}
.hp-hero::before {
    content: ''; position: absolute; top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(79,70,229,.08) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(14,165,233,.06) 0%, transparent 50%);
}
.hp-hero h1 {
    font-size: 58px; font-weight: 800; line-height: 1.1;
    margin-bottom: 24px; position: relative;
    background: linear-gradient(135deg, var(--dark) 0%, var(--primary) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hp-hero p { font-size: 22px; color: var(--gray); max-width: 640px; margin: 0 auto 40px; position: relative; }
.hp-hero-actions { display: flex; gap: 16px; justify-content: center; position: relative; }

.hp-section { padding: 80px 40px; max-width: 1200px; margin: 0 auto; }
.hp-section-alt { background: var(--white); }
.hp-section h2 { font-size: 38px; font-weight: 700; text-align: center; margin-bottom: 16px; }
.hp-section .subtitle { font-size: 20px; color: var(--gray); text-align: center; margin-bottom: 56px; max-width: 600px; margin-left: auto; margin-right: auto; }

.hp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.hp-card {
    background: var(--white); border-radius: 16px; padding: 40px 32px;
    border: 1px solid var(--gray-lighter); transition: var(--transition);
}
.hp-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.hp-card-icon {
    width: 56px; height: 56px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; margin-bottom: 20px;
    background: linear-gradient(135deg, #eef2ff, #e0e7ff);
    color: var(--primary);
}
.hp-card h3 { font-size: 22px; font-weight: 700; margin-bottom: 12px; }
.hp-card p { color: var(--gray); font-size: 17px; line-height: 1.7; }

.hp-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; padding: 60px 40px; max-width: 1200px; margin: 0 auto; }
.hp-stat { text-align: center; }
.hp-stat .number { font-size: 50px; font-weight: 800; color: var(--primary); }
.hp-stat .label { font-size: 17px; color: var(--gray); margin-top: 4px; }

.hp-cta {
    text-align: center; padding: 80px 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
}
.hp-cta h2 { color: #fff; font-size: 38px; margin-bottom: 16px; }
.hp-cta p { color: rgba(255,255,255,.8); font-size: 20px; margin-bottom: 32px; }
.hp-cta .btn { background: #fff; color: var(--primary); }
.hp-cta .btn:hover { background: var(--light); color: var(--primary-dark); }

.hp-footer {
    padding: 40px; text-align: center; color: var(--gray);
    font-size: 16px; border-top: 1px solid var(--gray-lighter);
}

/* ============================================
   AUTH PAGES
   ============================================ */
.auth-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
}
.auth-card {
    background: var(--white); border-radius: 16px; padding: 48px;
    width: 100%; max-width: 420px; box-shadow: var(--shadow-lg);
}
.auth-card .logo { text-align: center; margin-bottom: 32px; font-size: 30px; font-weight: 800; color: var(--primary); }
.auth-card .logo span { color: var(--dark); }
.auth-card h2 { font-size: 24px; margin-bottom: 8px; text-align: center; }
.auth-card .sub { color: var(--gray); font-size: 16px; text-align: center; margin-bottom: 32px; }

.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--dark-2); }
.form-control {
    width: 100%; padding: 10px 14px; border: 1px solid var(--gray-lighter);
    border-radius: var(--radius); font-size: 16px; transition: var(--transition);
    background: var(--white); color: var(--dark);
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.1); }
select.form-control {
    cursor: pointer;
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}
input[type="file"].form-control {
    padding: 8px 14px;
    cursor: pointer;
}
input[type="file"].form-control::file-selector-button {
    background: var(--primary); color: #fff; border: none;
    padding: 6px 16px; border-radius: 6px; font-size: 15px;
    font-weight: 600; cursor: pointer; margin-right: 12px;
    transition: var(--transition);
}
input[type="file"].form-control::file-selector-button:hover {
    background: var(--primary-dark);
}
textarea.form-control { resize: vertical; min-height: 100px; }

.alert {
    padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px;
    font-size: 16px; font-weight: 500;
}
.alert-danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard-wrapper {
    display: flex; min-height: 100vh;
}

/* Icon sidebar (left column) */
.sidebar-icons {
    width: var(--sidebar-icon-width); background: var(--dark);
    display: flex; flex-direction: column; align-items: center;
    padding: 16px 0; position: fixed; top: 0; bottom: 0; left: 0;
    z-index: 50;
}
.sidebar-icons .si-logo {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 18px; margin-bottom: 24px;
}
.sidebar-icons .si-item {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--gray-light); font-size: 22px; cursor: pointer;
    transition: var(--transition); margin-bottom: 4px; position: relative;
    border: none; background: none;
}
.sidebar-icons .si-item:hover { color: #fff; background: rgba(255,255,255,.1); }
.sidebar-icons .si-item.active { color: #fff; background: var(--primary); }
.sidebar-icons .si-item .si-tooltip {
    position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%);
    background: var(--dark); color: #fff; padding: 4px 10px; border-radius: 6px;
    font-size: 14px; white-space: nowrap; opacity: 0; pointer-events: none;
    transition: opacity .15s;
}
.sidebar-icons .si-item:hover .si-tooltip { opacity: 1; }

.sidebar-icons .si-separator {
    width: 32px; height: 1px; background: rgba(255,255,255,.12);
    margin: 12px 0;
}

.sidebar-icons .si-bottom {
    margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.sidebar-icons .si-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--primary-light); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: 700;
}

/* Text sidebar (right column) */
.sidebar-text {
    width: var(--sidebar-text-width); background: var(--white);
    position: fixed; top: 0; bottom: 0;
    left: var(--sidebar-icon-width);
    border-right: 1px solid var(--gray-lighter);
    overflow-y: auto; z-index: 40;
    display: flex; flex-direction: column;
}
.sidebar-text .st-header {
    padding: 20px 20px 12px;
    font-size: 15px; font-weight: 700; color: var(--gray);
    text-transform: uppercase; letter-spacing: .5px;
    border-bottom: 1px solid var(--gray-lighter);
}
.sidebar-text .st-menu { padding: 8px 12px; flex: 1; }
.sidebar-text .st-menu a {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius);
    color: var(--gray); font-size: 16px; font-weight: 500;
    transition: var(--transition);
}
.sidebar-text .st-menu a:hover { background: var(--light); color: var(--dark); }
.sidebar-text .st-menu a.active { background: #eef2ff; color: var(--primary); font-weight: 600; }
.sidebar-text .st-menu a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-text .st-menu .menu-section {
    font-size: 13px; font-weight: 700; color: var(--gray-light);
    text-transform: uppercase; letter-spacing: .5px;
    padding: 16px 12px 6px;
}

/* Panel groups - each role's menu panel */
.st-panel { display: none; }
.st-panel.active { display: flex; flex-direction: column; height: 100%; }

/* Main content */
.main-content {
    flex: 1;
    margin-left: calc(var(--sidebar-icon-width) + var(--sidebar-text-width));
    padding: 32px;
    min-height: 100vh;
}

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 32px;
}
.page-header h1 { font-size: 26px; font-weight: 700; }
.page-header .breadcrumb { font-size: 15px; color: var(--gray); }

/* Stats cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card {
    background: var(--white); border-radius: var(--radius); padding: 24px;
    border: 1px solid var(--gray-lighter);
}
.stat-card .stat-label { font-size: 15px; color: var(--gray); font-weight: 500; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 30px; font-weight: 700; color: var(--dark); }
.stat-card .stat-change { font-size: 15px; margin-top: 4px; }
.stat-card .stat-change.up { color: var(--success); }
.stat-card .stat-change.down { color: var(--danger); }

/* Tables */
.table-wrapper {
    background: var(--white); border-radius: var(--radius);
    border: 1px solid var(--gray-lighter); overflow: hidden;
}
.table-header {
    padding: 16px 20px; border-bottom: 1px solid var(--gray-lighter);
    display: flex; align-items: center; justify-content: space-between;
}
.table-header h3 { font-size: 18px; font-weight: 600; }

table {
    width: 100%; border-collapse: collapse;
}
thead th {
    padding: 12px 20px; text-align: left; font-size: 14px;
    font-weight: 600; color: var(--gray); text-transform: uppercase;
    letter-spacing: .5px; border-bottom: 1px solid var(--gray-lighter);
    background: var(--light);
}
tbody td {
    padding: 14px 20px; border-bottom: 1px solid var(--gray-lighter);
    font-size: 16px;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 50px;
    font-size: 14px; font-weight: 600;
}
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fef2f2; color: #991b1b; }
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-paused { background: #fef3c7; color: #92400e; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-completed { background: #dbeafe; color: #1e40af; }
.badge-superadmin { background: #fae8ff; color: #86198f; }
.badge-advertiser { background: #dbeafe; color: #1e40af; }
.badge-publisher { background: #dcfce7; color: #166534; }

/* Forms in dashboard */
.form-card {
    background: var(--white); border-radius: var(--radius);
    border: 1px solid var(--gray-lighter); padding: 32px;
    max-width: 800px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-actions { margin-top: 24px; display: flex; gap: 12px; }

/* Form sections */
.form-section {
    padding-bottom: 24px; margin-bottom: 24px;
    border-bottom: 1px solid var(--gray-lighter);
}
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title {
    font-size: 17px; font-weight: 700; color: var(--dark);
    margin-bottom: 20px; padding-bottom: 8px;
}

/* Schedule table */
.schedule-table { width: 100%; }
.schedule-table th { padding: 8px 12px; font-size: 15px; font-weight: 600; }
.schedule-table td { padding: 6px 8px; }
.schedule-table .form-control { padding: 6px 10px; font-size: 15px; }

/* ============================================
   FLATPICKR OVERRIDES (bigger calendar)
   ============================================ */
.flatpickr-calendar {
    width: 340px !important;
    font-family: 'Inter', sans-serif !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: 12px !important;
    border: 1px solid var(--gray-lighter) !important;
}
.flatpickr-months {
    padding: 8px 4px 4px !important;
}
.flatpickr-months .flatpickr-month {
    height: 40px !important;
}
.flatpickr-current-month {
    font-size: 17px !important;
    font-weight: 600 !important;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    font-size: 17px !important;
    font-weight: 600 !important;
}
span.flatpickr-weekday {
    font-size: 14px !important;
    font-weight: 600 !important;
    color: var(--gray) !important;
}
.flatpickr-day {
    width: 42px !important;
    height: 42px !important;
    line-height: 42px !important;
    font-size: 16px !important;
    border-radius: 8px !important;
    margin: 1px !important;
}
.flatpickr-day.today:not(.selected) {
    border-color: var(--primary) !important;
}
.flatpickr-day.selected {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
}
.dayContainer {
    width: 336px !important;
    min-width: 336px !important;
    max-width: 336px !important;
}
.flatpickr-days {
    width: 340px !important;
}
.flatpickr-innerContainer {
    padding: 4px 0 8px !important;
}
.flatpickr-prev-month, .flatpickr-next-month {
    padding: 8px 12px !important;
}
.flatpickr-prev-month svg, .flatpickr-next-month svg {
    width: 16px !important;
    height: 16px !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .hp-grid { grid-template-columns: repeat(2, 1fr); }
    .hp-stats { grid-template-columns: repeat(2, 1fr); }
    .hp-hero h1 { font-size: 42px; }
}
@media (max-width: 768px) {
    .hp-grid { grid-template-columns: 1fr; }
    .hp-stats { grid-template-columns: 1fr 1fr; }
    .hp-hero { padding: 120px 20px 60px; }
    .hp-hero h1 { font-size: 34px; }
    .hp-hero p { font-size: 18px; }
    .hp-section { padding: 60px 20px; }
    .hp-nav { padding: 0 20px; }
    .hp-hero-actions { flex-direction: column; align-items: center; }
    .sidebar-text { display: none; }
    .main-content { margin-left: var(--sidebar-icon-width); }
    .form-row { grid-template-columns: 1fr; }
}
