/**
 * BJS Ads Manager - Frontend Styles
 * Modern CSS Design System with Premium Gradients, Borders, Hover Effects, and Responsive Tables.
 * @package BJS_Ads_Manager
 * @since 1.0.0
 */

:root {
    --bjs-primary: #f97316; /* Brand Orange */
    --bjs-primary-hover: #ea580c;
    --bjs-secondary: #4f46e5; /* Modern Indigo */
    --bjs-secondary-hover: #4338ca;
    
    --bjs-bg-main: #f8fafc;
    --bjs-bg-card: #ffffff;
    --bjs-border: #e2e8f0;
    
    --bjs-text-main: #1e293b;
    --bjs-text-muted: #64748b;
    
    --bjs-success: #10b981;
    --bjs-success-bg: #e6fbf2;
    --bjs-success-text: #065f46;
    
    --bjs-warning: #f59e0b;
    --bjs-warning-bg: #fffbeb;
    --bjs-warning-text: #92400e;
    
    --bjs-danger: #ef4444;
    --bjs-danger-bg: #fef2f2;
    --bjs-danger-text: #991b1b;
    
    --bjs-info: #0ea5e9;
    --bjs-info-bg: #f0f9ff;
    --bjs-info-text: #0369a1;
    
    --bjs-radius-sm: 6px;
    --bjs-radius-md: 10px;
    --bjs-radius-lg: 16px;
    --bjs-radius-pill: 9999px;
    
    --bjs-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --bjs-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --bjs-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    
    --bjs-transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =====================================================
   AD SLOT DISPLAY
   ===================================================== */
.bjs-ad-slot {
    margin: 20px auto;
    text-align: center;
    position: relative;
    overflow: hidden;
    border-radius: var(--bjs-radius-md);
}

.bjs-ad-slot.loading {
    background: #f1f5f9;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bjs-ad-container {
    display: block;
    position: relative;
    text-decoration: none;
}

.bjs-ad-container img {
    max-width: 100%;
    height: auto;
    display: block;
    border-radius: var(--bjs-radius-sm);
}

.bjs-ad-label {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(15, 23, 42, 0.75);
    color: #fff;
    padding: 3px 8px;
    font-size: 9px;
    font-weight: 600;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Text Ad Styles */
.bjs-text-ad {
    background: var(--bjs-bg-card);
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    padding: 24px;
    text-align: left;
    box-shadow: var(--bjs-shadow-sm);
    transition: var(--bjs-transition);
}

.bjs-text-ad:hover {
    box-shadow: var(--bjs-shadow-lg);
    transform: translateY(-2px);
}

.bjs-text-ad h3 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--bjs-text-main);
}

.bjs-text-ad p {
    margin: 0 0 16px;
    font-size: 14px;
    color: var(--bjs-text-muted);
    line-height: 1.6;
}

.bjs-text-ad .bjs-cta-button {
    display: inline-block;
    padding: 8px 18px;
    background: var(--bjs-secondary);
    color: #fff !important;
    text-decoration: none;
    border-radius: var(--bjs-radius-sm);
    font-weight: 600;
    font-size: 13px;
    transition: var(--bjs-transition);
}

.bjs-text-ad .bjs-cta-button:hover {
    background: var(--bjs-secondary-hover);
}

/* =====================================================
   EMPLOYER DASHBOARD & MY CAMPAIGNS VIEW
   ===================================================== */
.bjs-employer-dashboard,
.bjs-my-campaigns {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--bjs-text-main);
}

.bjs-dashboard-header,
.bjs-campaigns-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bjs-border);
}

.bjs-dashboard-header h1,
.bjs-campaigns-header h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: #0f172a;
    letter-spacing: -0.025em;
}

/* Global button updates in dashboard contexts */
.bjs-employer-dashboard .button,
.bjs-employer-dashboard button,
.bjs-my-campaigns .button,
.bjs-my-campaigns button {
    font-size: 13px;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--bjs-radius-sm);
    border: 1px solid #cbd5e1;
    background: #fff;
    color: #334155;
    box-shadow: var(--bjs-shadow-sm);
    cursor: pointer;
    text-decoration: none;
    transition: var(--bjs-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
}

.bjs-employer-dashboard .button:hover,
.bjs-my-campaigns .button:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #0f172a;
}

.bjs-employer-dashboard .button-primary,
.bjs-my-campaigns .button-primary {
    background: var(--bjs-primary) !important;
    border-color: var(--bjs-primary) !important;
    color: #ffffff !important;
}

.bjs-employer-dashboard .button-primary:hover,
.bjs-my-campaigns .button-primary:hover {
    background: var(--bjs-primary-hover) !important;
    border-color: var(--bjs-primary-hover) !important;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: var(--bjs-shadow-md);
}

/* Dashboard Stats */
.bjs-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 36px;
}

.bjs-stat-box {
    background: var(--bjs-bg-card);
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--bjs-transition);
    box-shadow: var(--bjs-shadow-sm);
}

.bjs-stat-box:hover {
    box-shadow: var(--bjs-shadow-md);
    transform: translateY(-2px);
    border-color: #cbd5e1;
}

.bjs-stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f1f5f9;
    flex-shrink: 0;
    transition: var(--bjs-transition);
}

.bjs-stat-icon .dashicons {
    font-size: 24px;
    width: 24px;
    height: 24px;
    color: var(--bjs-text-muted);
}

.bjs-stat-icon.active {
    background: var(--bjs-success-bg);
}
.bjs-stat-icon.active .dashicons {
    color: var(--bjs-success);
}

.bjs-stat-icon.wallet {
    background: var(--bjs-info-bg);
}
.bjs-stat-icon.wallet .dashicons {
    color: var(--bjs-info);
}

.bjs-stat-icon.spent {
    background: var(--bjs-danger-bg);
}
.bjs-stat-icon.spent .dashicons {
    color: var(--bjs-danger);
}

.bjs-stat-content h3 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}

.bjs-stat-content p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--bjs-text-muted);
}

/* Dashboard Sections */
.bjs-dashboard-section {
    background: var(--bjs-bg-card);
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    padding: 24px;
    box-shadow: var(--bjs-shadow-sm);
}

.bjs-dashboard-section h2 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
    color: #0f172a;
}

/* Quick Actions Cards */
.bjs-quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.bjs-action-card {
    background: #f8fafc;
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    padding: 24px;
    text-align: center;
    text-decoration: none;
    transition: var(--bjs-transition);
    display: block;
}

.bjs-action-card:hover {
    border-color: var(--bjs-secondary);
    background: #fff;
    box-shadow: var(--bjs-shadow-md);
    transform: translateY(-2px);
}

.bjs-action-card .dashicons {
    font-size: 32px;
    width: 32px;
    height: 32px;
    color: var(--bjs-secondary);
    margin-bottom: 8px;
}

.bjs-action-card h3 {
    margin: 8px 0;
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.bjs-action-card p {
    margin: 0;
    font-size: 12px;
    color: var(--bjs-text-muted);
}

/* =====================================================
   CAMPAIGNS TABLE REDESIGN
   ===================================================== */
.bjs-campaigns-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    box-shadow: var(--bjs-shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.bjs-campaigns-table thead {
    background: #f8fafc;
}

.bjs-campaigns-table th {
    padding: 16px 18px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 12px;
    border-bottom: 1px solid var(--bjs-border);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bjs-campaigns-table td {
    padding: 16px 18px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
    font-size: 13px;
    color: #334155;
}

.bjs-campaigns-table tr:last-child td {
    border-bottom: none;
}

.bjs-campaigns-table tr:hover td {
    background: #f8fafc;
}

.bjs-campaigns-table a {
    color: var(--bjs-primary);
    text-decoration: none;
    font-weight: 600;
    transition: var(--bjs-transition);
}

.bjs-campaigns-table a:hover {
    color: var(--bjs-primary-hover);
    text-decoration: underline;
}

/* Custom Status Badges from helper function (fixing capsule look) */
.badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    padding: 4px 10px !important;
    border-radius: var(--bjs-radius-pill) !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    line-height: 1.2 !important;
    border: 1px solid transparent;
}

.badge-success {
    background-color: var(--bjs-success-bg) !important;
    color: var(--bjs-success-text) !important;
    border-color: rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background-color: var(--bjs-warning-bg) !important;
    color: var(--bjs-warning-text) !important;
    border-color: rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background-color: var(--bjs-danger-bg) !important;
    color: var(--bjs-danger-text) !important;
    border-color: rgba(239, 68, 68, 0.2);
}

.badge-info {
    background-color: var(--bjs-info-bg) !important;
    color: var(--bjs-info-text) !important;
    border-color: rgba(14, 165, 233, 0.2);
}

.badge-secondary {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border-color: rgba(71, 85, 105, 0.15);
}

/* =====================================================
   CAMPAIGN ANALYTICS
   ===================================================== */
.bjs-campaign-analytics {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.bjs-campaign-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bjs-border);
}

.bjs-campaign-header h1 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
}

.bjs-campaign-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 36px;
}

.bjs-stat-card {
    background: var(--bjs-bg-card);
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    padding: 24px;
    text-align: center;
    box-shadow: var(--bjs-shadow-sm);
    transition: var(--bjs-transition);
}

.bjs-stat-card:hover {
    box-shadow: var(--bjs-shadow-md);
    border-color: #cbd5e1;
}

.bjs-stat-card h3 {
    margin: 0 0 6px;
    font-size: 30px;
    font-weight: 700;
    color: #0f172a;
}

.bjs-stat-card p {
    margin: 0;
    font-size: 11px;
    color: var(--bjs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.bjs-campaign-ads {
    background: var(--bjs-bg-card);
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    padding: 24px;
    box-shadow: var(--bjs-shadow-sm);
}

.bjs-campaign-ads h2 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
}

/* =====================================================
   WALLET & BILLING PAGE
   ===================================================== */
.bjs-wallet-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px;
}

.bjs-wallet-balance-card {
    background: linear-gradient(135deg, var(--bjs-secondary) 0%, #312e81 100%);
    color: #fff;
    border-radius: var(--bjs-radius-lg);
    padding: 36px;
    margin-bottom: 36px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--bjs-shadow-lg);
    position: relative;
    overflow: hidden;
}

.bjs-wallet-balance-card::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50%;
    right: -50px;
    top: -50px;
}

.bjs-balance-info h2 {
    margin: 0 0 8px;
    font-size: 15px;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.bjs-balance-amount {
    font-size: 42px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.01em;
}

.bjs-balance-actions .button {
    background: #fff !important;
    color: var(--bjs-secondary) !important;
    border: 1px solid #ffffff !important;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 700;
    border-radius: var(--bjs-radius-sm);
    cursor: pointer;
    box-shadow: var(--bjs-shadow-md);
    transition: var(--bjs-transition);
}

.bjs-balance-actions .button:hover {
    transform: translateY(-2px);
    box-shadow: var(--bjs-shadow-lg);
    background: #f8fafc !important;
}

.bjs-transactions-section {
    background: var(--bjs-bg-card);
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    padding: 24px;
    box-shadow: var(--bjs-shadow-sm);
}

.bjs-transactions-section h2 {
    margin: 0 0 20px;
    font-size: 18px;
    font-weight: 600;
}

.bjs-transactions-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.bjs-transactions-table th {
    padding: 12px 14px;
    text-align: left;
    background: #f8fafc;
    font-weight: 600;
    color: #475569;
    border-bottom: 1px solid var(--bjs-border);
}

.bjs-transactions-table td {
    padding: 14px;
    border-bottom: 1px solid #f1f5f9;
}

.bjs-transactions-table tr:last-child td {
    border-bottom: none;
}

.bjs-transaction-type {
    display: inline-block;
    padding: 3px 8px;
    border-radius: var(--bjs-radius-pill);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.bjs-transaction-type.bjs-type-credit {
    background: var(--bjs-success-bg);
    color: var(--bjs-success-text);
}

.bjs-transaction-type.bjs-type-debit {
    background: var(--bjs-danger-bg);
    color: var(--bjs-danger-text);
}

.bjs-amount {
    font-weight: 700;
}

.bjs-amount.bjs-amount-credit {
    color: var(--bjs-success);
}

.bjs-amount.bjs-amount-debit {
    color: var(--bjs-danger);
}

/* =====================================================
   ACCESS DENIED / EMPTY STATES
   ===================================================== */
.bjs-access-denied,
.bjs-empty-state {
    max-width: 560px;
    margin: 40px auto;
    text-align: center;
    padding: 36px;
    background: #fff;
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    box-shadow: var(--bjs-shadow-md);
}

.bjs-access-denied h3,
.bjs-empty-state h3 {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 700;
}

.bjs-access-denied p,
.bjs-empty-state p {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--bjs-text-muted);
}

/* =====================================================
   STEP FORM DESIGN IMPROVEMENTS
   ===================================================== */
.bjs-form-step {
    display: none;
    background: #fff;
    border: 1px solid var(--bjs-border);
    border-radius: var(--bjs-radius-md);
    padding: 28px;
    box-shadow: var(--bjs-shadow-sm);
    margin-bottom: 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.bjs-form-step.active {
    display: block;
}

.bjs-form-step h2 {
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin-top: 0;
    margin-bottom: 12px;
}

.bjs-form-step p {
    font-size: 13px;
    color: var(--bjs-text-muted);
    margin-top: 0;
    margin-bottom: 24px;
}

/* Forms layout elements */
.bjs-form-group {
    margin-bottom: 20px;
}

.bjs-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.bjs-form-row {
    display: flex;
    gap: 20px;
}

.bjs-form-row .bjs-form-group {
    flex: 1;
}

/* Text fields and custom options style */
.bjs-form-control {
    width: 100% !important;
    max-width: 100% !important;
    padding: 8px 12px !important;
    font-size: 13px !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: var(--bjs-radius-sm) !important;
    transition: var(--bjs-transition) !important;
}

.bjs-form-control:focus {
    border-color: var(--bjs-primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15) !important;
}

/* Help description styling */
.bjs-help-text {
    font-size: 12px;
    color: var(--bjs-text-muted);
    margin-top: 6px;
    margin-bottom: 0;
}

/* Actions buttons wrap */
.bjs-form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--bjs-border);
}

.bjs-invalid-field {
    border-color: var(--bjs-danger) !important;
    background-color: #fffdfd !important;
}

.bjs-invalid-field:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15) !important;
}

/* =====================================================
   RESPONSIVE DESIGN
   ===================================================== */
@media screen and (max-width: 768px) {
    .bjs-dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .bjs-dashboard-header,
    .bjs-campaigns-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .bjs-quick-actions {
        grid-template-columns: 1fr;
    }
    
    .bjs-campaign-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .bjs-wallet-balance-card {
        flex-direction: column;
        text-align: center;
        gap: 24px;
    }
    
    .bjs-form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .bjs-campaigns-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* =====================================================
   AD PREVIEWS TOGGLE BUTTONS STYLE
   ===================================================== */
.bjs-preview-mode-btn, 
.bjs-preview-toggle {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #cbd5e1 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 8px 16px !important;
    border-radius: var(--bjs-radius-sm) !important;
    cursor: pointer !important;
    transition: var(--bjs-transition) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-shadow: var(--bjs-shadow-sm) !important;
}

.bjs-preview-mode-btn.active, 
.bjs-preview-toggle.active {
    background: var(--bjs-primary) !important;
    color: #ffffff !important;
    border-color: var(--bjs-primary) !important;
}

.bjs-preview-mode-btn:hover, 
.bjs-preview-toggle:hover {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

.bjs-preview-mode-btn.active:hover, 
.bjs-preview-toggle.active:hover {
    background: var(--bjs-primary-hover) !important;
    color: #ffffff !important;
    border-color: var(--bjs-primary-hover) !important;
}

/* Terms & Conditions Modal Styling */
body.bjs-modal-open {
    overflow: hidden !important;
}

#bjs-terms-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
}

.bjs-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.bjs-modal-container {
    animation: bjs-modal-fade-in 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes bjs-modal-fade-in {
    from {
        opacity: 0;
        transform: translate(-50%, -48%) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.bjs-modal-close:hover {
    color: #1e293b !important;
}

.bjs-modal-body::-webkit-scrollbar {
    width: 6px;
}
.bjs-modal-body::-webkit-scrollbar-track {
    background: #f1f5f9;
}
.bjs-modal-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.bjs-modal-body::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.bjs-terms-acceptance-group {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 12px 16px;
    border-radius: var(--bjs-radius-md);
    margin-top: 15px !important;
    margin-bottom: 20px !important;
}

