/* Facebook Ad Accounts Dashboard - Modern Glassmorphism Styling */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #0B0F19;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-card-hover: rgba(31, 41, 55, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(59, 130, 246, 0.3);
    
    --primary: #2563EB;
    --primary-hover: #1D4ED8;
    --fb-blue: #1877F2;
    --fb-blue-hover: #166FE5;
    
    --text-primary: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-muted: #6B7280;
    
    --status-active-bg: rgba(16, 185, 129, 0.15);
    --status-active-color: #10B981;
    --status-disabled-bg: rgba(239, 68, 68, 0.15);
    --status-disabled-color: #EF4444;
    --status-unsettled-bg: rgba(245, 158, 11, 0.15);
    --status-unsettled-color: #F59E0B;
    --status-pending-bg: rgba(139, 92, 246, 0.15);
    --status-pending-color: #A78BFA;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 25px rgba(24, 119, 242, 0.25);
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(24, 119, 242, 0.12) 0%, transparent 40%),
        radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.1) 0%, transparent 45%);
    background-attachment: fixed;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Glassmorphism Container */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-soft);
}

/* Header Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--fb-blue), #8B5CF6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 4px 15px rgba(24, 119, 242, 0.4);
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #FFFFFF, #9CA3AF);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.4rem 0.5rem 0.4rem 1rem;
    border-radius: 50px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--fb-blue);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.75rem 1.4rem;
    font-family: var(--font-body);
    font-size: 0.925rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.btn-fb {
    background: linear-gradient(135deg, var(--fb-blue), #1565C0);
    color: #fff;
    box-shadow: 0 4px 20px rgba(24, 119, 242, 0.35);
}

.btn-fb:hover {
    background: linear-gradient(135deg, var(--fb-blue-hover), #0D47A1);
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(24, 119, 242, 0.5);
}

.btn-purple {
    background: linear-gradient(135deg, #8B5CF6, #6D28D9);
    color: #fff;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
}

.btn-purple:hover {
    background: linear-gradient(135deg, #7C3AED, #5B21B6);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.825rem;
}

/* Main Layout */
.container {
    max-width: 1280px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Hero Section (When not logged in) */
.hero-card {
    text-align: center;
    padding: 4rem 2rem;
    margin: 2rem 0;
}

.hero-icon {
    font-size: 3.5rem;
    color: var(--fb-blue);
    margin-bottom: 1.5rem;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 650px;
    margin: 0 auto 2.5rem;
}

.action-options {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

/* Stats Metric Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-glow);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-icon {
    font-size: 1.25rem;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #FFF;
}

.stat-footer {
    font-size: 0.775rem;
    color: var(--text-muted);
}

/* Controls Bar */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    flex: 1;
    min-width: 280px;
}

.search-box input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.6rem;
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.search-box input:focus {
    border-color: var(--fb-blue);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.filter-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

.filter-select {
    padding: 0.75rem 1rem;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
}

/* Checkbox Style */
.custom-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--fb-blue);
    cursor: pointer;
}

/* Selection Action Banner */
.selection-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(139, 92, 246, 0.2));
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;

}

/* Ad Accounts Table / Grid */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.account-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.account-card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 12px 35px -10px rgba(0, 0, 0, 0.6);
    transform: translateY(-2px);
}

.account-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.account-name {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: #FFF;
    margin-bottom: 0.25rem;
}

.account-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: monospace;
}

.badge {
    padding: 0.3rem 0.65rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.badge-active {
    background: var(--status-active-bg);
    color: var(--status-active-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-disabled {
    background: var(--status-disabled-bg);
    color: var(--status-disabled-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-unsettled {
    background: var(--status-unsettled-bg);
    color: var(--status-unsettled-color);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-pending {
    background: var(--status-pending-bg);
    color: var(--status-pending-color);
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.account-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-val {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.account-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

/* Modal Z-Index Stacking Hierarchy */
#report-modal {
    z-index: 1000;
}

#preset-modal, #token-modal, #json-modal {
    z-index: 1100;
}

#page-name-modal {
    z-index: 1200;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: #FFF;
}

pre.json-viewer {
    background: rgba(0, 0, 0, 0.5);
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    font-family: monospace;
    font-size: 0.825rem;
    color: #34D399;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

/* Report Table */
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.report-table th, .report-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.report-table th {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    background: rgba(0, 0, 0, 0.3);
}

.progress-bar-bg {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 4px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #10B981, #3B82F6);
    border-radius: 10px;
}

/* Loader */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--fb-blue);
    animation: spin 0.8s linear infinite;
    margin: 3rem auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #F87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
