/* ========================================
   Ads Manager - Professional Theme
   ======================================== */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: linear-gradient(135deg, #312e81 0%, #4f46e5 100%);
    --sidebar-hover: rgba(255, 255, 255, 0.1);
    --sidebar-active: rgba(255, 255, 255, 0.18);
    --sidebar-active-border: #fff;
    --topbar-height: 60px;
    --body-bg: #f1f5f9;
    --card-radius: 12px;
    --primary: #4f46e5;
    --primary-light: #eef2ff;
    --success: #059669;
    --success-light: #ecfdf5;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --info: #0891b2;
    --info-light: #ecfeff;
    --danger: #dc2626;
    /* Tailwind CSS font stack */
    --font-sans: 'Inter var', 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

/* ---- Base ---- */
body {
    font-family: var(--font-sans);
    background: var(--body-bg);
    font-size: 0.875rem;
    color: #1e293b;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    letter-spacing: -0.011em;
    line-height: 1.5;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    min-height: 100vh;
    background: linear-gradient(180deg, #1e1b4b 0%, #312e81 40%, #4338ca 100%);
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-right: none;
}

.sidebar.collapsed {
    margin-left: calc(var(--sidebar-width) * -1);
}

.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand h5 {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: #fff;
    margin: 0;
}

.sidebar-brand span {
    color: #818cf8;
}

.sidebar-nav {
    padding: 12px;
    flex: 1;
}

.sidebar-nav .nav-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.35);
    padding: 16px 12px 6px;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.8125rem;
    font-weight: 500;
    margin-bottom: 2px;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.sidebar-nav .nav-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: var(--sidebar-active);
    color: #fff;
    border-left-color: var(--sidebar-active-border);
}

.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
}

/* ---- Topbar ---- */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar .breadcrumb {
    margin: 0;
    font-size: 0.8125rem;
}

.topbar .breadcrumb-item a {
    color: #64748b;
    text-decoration: none;
}

.topbar .breadcrumb-item.active {
    color: #1e293b;
    font-weight: 600;
}

.topbar .user-menu .btn {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 14px;
}

.topbar .user-menu .btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

/* ---- Main Content ---- */
#page-content {
    min-height: 100vh;
    flex: 1;
    display: flex;
    flex-direction: column;
}

main {
    padding: 28px;
    flex: 1;
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h4 {
    font-size: 1.375rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.025em;
    line-height: 1.3;
}

.page-header .btn-primary {
    font-size: 0.8125rem;
    font-weight: 600;
}

/* ---- Cards ---- */
.card {
    border: 1px solid #e2e8f0;
    border-radius: var(--card-radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    background: #fff;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: -0.011em;
    color: #1e293b;
}

.card-body {
    padding: 20px;
}

/* Stat Cards */
.stat-card {
    border: 1px solid #e2e8f0;
    border-radius: var(--card-radius);
    background: #fff;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.stat-icon.primary   { background: var(--primary-light); color: var(--primary); }
.stat-icon.success   { background: var(--success-light); color: var(--success); }
.stat-icon.warning   { background: var(--warning-light); color: var(--warning); }
.stat-icon.info      { background: var(--info-light);    color: var(--info); }

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ---- Tables ---- */
.table {
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.table thead th {
    font-weight: 600;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 16px;
    white-space: nowrap;
}

.table tbody td {
    padding: 12px 16px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
    letter-spacing: -0.006em;
}

.table-hover tbody tr:hover {
    background: #f8fafc;
}

/* ---- Badges ---- */
.badge {
    font-weight: 500;
    font-size: 0.6875rem;
    letter-spacing: 0.01em;
    padding: 3px 8px;
    border-radius: 6px;
    line-height: 1.4;
}

.badge-status-active {
    background: #dcfce7;
    color: #166534;
}

.badge-status-paused {
    background: #fef3c7;
    color: #92400e;
}

.badge-status-draft {
    background: #f1f5f9;
    color: #475569;
}

.badge-status-completed {
    background: #dbeafe;
    color: #1e40af;
}

/* ---- Buttons ---- */
.btn {
    font-family: var(--font-sans);
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 8px;
    padding: 8px 16px;
    letter-spacing: -0.006em;
    transition: all 0.15s ease;
}

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

.btn-primary:hover {
    background: #4338ca;
    border-color: #4338ca;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
    border-radius: 6px;
}

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

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

.btn-outline-danger {
    color: var(--danger);
    border-color: #fecaca;
}

.btn-outline-danger:hover {
    background: #fef2f2;
    border-color: var(--danger);
    color: var(--danger);
}

.btn-outline-secondary {
    color: #475569;
    border-color: #e2e8f0;
}

.btn-outline-secondary:hover {
    background: #f8fafc;
    color: #1e293b;
    border-color: #cbd5e1;
}

/* ---- Forms ---- */
.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: #374151;
    margin-bottom: 6px;
    letter-spacing: -0.006em;
}

.form-control, .form-select {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-family: var(--font-sans);
    padding: 9px 12px;
    color: #1e293b;
    letter-spacing: -0.006em;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control-sm, .form-select-sm {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.input-group-text {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    font-size: 0.875rem;
    border-radius: 8px;
}

/* ---- Filter Bar ---- */
.filter-bar {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--card-radius);
    padding: 12px 16px;
    margin-bottom: 16px;
}

/* ---- Charts ---- */
.chart-container {
    position: relative;
    height: 300px;
}

/* ---- Alert ---- */
.alert {
    border-radius: 10px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: none;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.alert-danger {
    background: #fef2f2;
    color: #991b1b;
}

/* ---- Login ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    background: #0f172a;
}

.login-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    position: relative;
    overflow: hidden;
}

.login-left::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    top: -100px;
    right: -100px;
}

.login-left::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
    bottom: -50px;
    left: -50px;
}

.login-left-content {
    position: relative;
    z-index: 1;
    max-width: 440px;
    color: #e2e8f0;
}

.login-left-content h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
    margin-bottom: 16px;
    line-height: 1.2;
}

.login-left-content p {
    font-size: 1rem;
    line-height: 1.7;
    color: #a5b4fc;
}

.login-features {
    margin-top: 40px;
    list-style: none;
    padding: 0;
}

.login-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    color: #c7d2fe;
    font-size: 0.875rem;
    font-weight: 500;
}

.login-features li i {
    font-size: 1rem;
    color: #818cf8;
    width: 32px;
    height: 32px;
    background: rgba(99, 102, 241, 0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.login-right {
    width: 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: #fff;
}

.login-form-wrapper {
    width: 100%;
    max-width: 380px;
}

.login-form-wrapper h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 4px;
}

.login-form-wrapper .subtitle {
    color: #64748b;
    font-size: 0.875rem;
    margin-bottom: 32px;
}

/* ---- Code Snippet ---- */
.code-snippet {
    background: #f0f4ff;
    color: #1e293b;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    padding: 14px 18px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
    overflow-x: auto;
    position: relative;
}

.code-snippet code {
    color: #312e81;
}

.code-snippet .copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #4f46e5;
    border: none;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.code-snippet .copy-btn:hover {
    background: #4338ca;
}

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: #94a3b8;
}

.empty-state i {
    font-size: 2.5rem;
    color: #cbd5e1;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 0.875rem;
    margin: 0;
}

/* ---- Preview Thumbnail ---- */
.preview-thumb {
    width: 64px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 2px;
}

/* ---- Action buttons group ---- */
.action-group {
    display: flex;
    gap: 4px;
    align-items: center;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        z-index: 1050;
        margin-left: calc(var(--sidebar-width) * -1);
    }

    .sidebar.show {
        margin-left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1040;
    }

    .sidebar.show ~ .sidebar-overlay {
        display: block;
    }

    main {
        padding: 16px;
    }

    .login-left {
        display: none;
    }

    .login-right {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
