/* --- Premium UI Variables --- */
:root {
    /* Color Palette: Warm Whites, Deep Slates, Saffron/Light Red */
    --bg-page: #faf9f8;
    --bg-surface: #ffffff;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-light: #e2e8f0;

    /* The Brand Color: Saffron / Light Coral Red */
    --brand-primary: #ea580c;
    --brand-hover: #c2410c;
    --brand-light: #ffedd5;

    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --radius-lg: 12px;
    --radius-md: 8px;
    --font-stack: 'Plus Jakarta Sans', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    scroll-behavior: smooth;
    max-width: 100vw;
    overflow-x: hidden;
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

/* --- Navigation --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    background: transparent;
}

.nav-brand {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.nav-brand span {
    color: var(--brand-primary);
}

.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.nav-links a:hover {
    color: var(--text-main);
}

/* --- Hero Section (100vh Full Screen) --- */
.hero-section {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 60px 5% 2rem;
}

.hero-content {
    max-width: 800px;
    width: 100%;
}

.badge-pill {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: var(--brand-light);
    color: var(--brand-primary);
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.hero-content h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
    color: var(--text-main);
}

.hero-content h1 span {
    color: var(--brand-primary);
}

.hero-content p {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-muted);
    margin: 0 auto 2.5rem;
    max-width: 600px;
}

/* --- Buttons --- */
.btn-primary, .btn-outline {
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-md);
    font-family: var(--font-stack);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.btn-primary {
    background: var(--brand-primary);
    color: white;
    border: 2px solid var(--brand-primary);
    box-shadow: var(--shadow-soft);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

.btn-outline {
    background: transparent;
    color: var(--text-main);
    border: 2px solid var(--border-light);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--text-main);
    /* background: white; */
    transform: scale(1.01);
    box-shadow: var(--shadow-soft);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn-large {
    padding: 1.1rem 3rem;
    font-size: 1.1rem;
    border-radius: 50px;
}

/* --- App Workspace Layout --- */
.app-workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 2.5rem;
    padding: 2rem 5% 5rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* Sidebar Controls */
.app-sidebar {
    background: var(--bg-surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-light);
    height: fit-content;
}

.sidebar-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.control-group {
    margin-bottom: 1.75rem;
}

.control-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-main);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Custom Inputs & Selects */
.select-css {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    font-family: var(--font-stack);
    font-size: 0.95rem;
    font-weight: 500;
    outline: none;
    transition: var(--transition);
    color: var(--text-main);
    appearance: none;
}

input[type="text"].select-css,
input[type="email"].select-css,
input[type="tel"].select-css {
    appearance: auto;
}

.select-css:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-light);
}

.select-css:disabled {
    background-color: var(--bg-page);
    color: #cbd5e1;
    cursor: not-allowed;
}

/* Custom File Upload */
.file-upload-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-input {
    display: none;
}

.file-btn {
    background: var(--bg-page);
    border: 1px dashed #cbd5e1;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    color: var(--text-muted);
}

.file-btn:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: var(--brand-light);
}

.file-name {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    word-break: break-all;
}

.action-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

/* --- Main Data Area --- */
.app-main {
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    min-width: 0;
}

/* NEW: Editable Chart Title */
.editable-title-input {
    width: 100%;
    font-family: var(--font-stack);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    text-align: center;
    background: transparent;
    border: none;
    border-bottom: 2px dashed transparent;
    padding: 0.5rem;
    outline: none;
    transition: var(--transition);
    letter-spacing: -0.5px;
}

.editable-title-input:hover,
.editable-title-input:focus {
    border-bottom: 2px dashed var(--brand-primary);
    background-color: var(--bg-surface);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.editable-title-input::placeholder {
    color: #cbd5e1;
    font-weight: 500;
}

.canvas-container {
    background: var(--bg-surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-light);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    height: 50vh;
}

.empty-state {
    text-align: center;
    color: var(--text-muted);
    position: absolute;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

canvas {
    width: 100% !important;
    height: 100% !important;
    z-index: 10;
    display: none;
}

/* Data Table Preview */
.data-preview-container {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--border-light);
    overflow: hidden;
}

.preview-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.preview-header h4 {
    font-weight: 700;
    font-size: 1.1rem;
}

.badge {
    background: var(--bg-page);
    color: var(--text-muted);
    padding: 0.3rem 0.8rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid var(--border-light);
}

.table-scroll {
    max-height: 350px;
    overflow-y: auto;
    overflow-x: auto;
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: left;
}

.modern-table th, .modern-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.modern-table th {
    background: var(--bg-page);
    position: sticky;
    top: 0;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    z-index: 5;
}

.empty-cell {
    text-align: center;
    padding: 3rem !important;
    color: var(--text-muted);
}

/* Multi-Select Filter Box */
.multi-select-box {
    width: 100%;
    height: 120px;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background-color: var(--bg-surface);
    padding: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-main);
}

.disabled-box {
    background-color: var(--bg-page);
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-style: italic;
}

/* --- Strict 3:1 Ad Banner --- */
.ad-placeholder {
    width: 100%;
    /* max-width: 900px; */
    aspect-ratio: 3 / 1;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* --- Footer --- */
.site-footer {
    background: #0f172a;
    color: white;
    padding: 4rem 5% 2rem;
}

.footer-brand {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.footer-brand span {
    color: var(--brand-primary);
}

.visit-counter {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
}

.counter-label {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 600;
}

.counter-number {
    font-weight: 700;
    color: var(--brand-primary);
    font-variant-numeric: tabular-nums;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    color: #64748b;
    font-size: 0.9rem;
    max-width: 1200px;
    margin: 0 auto;
    font-weight: 500;
}

.legal-links {
    display: flex;
    gap: 1.5rem;
}

.legal-links a:hover {
    color: white;
}

/* --- Modals --- */
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background-color: var(--bg-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-hover);
    border: 1px solid var(--border-light);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--brand-primary);
}

/* --- Responsive Breakpoints --- */
@media (max-width: 1024px) {
    .app-workspace {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .app-sidebar {
        order: 2;
    }

    .app-main {
        order: 1;
    }

    .nav-links {
        display: none;
    }
}

@media (max-width: 768px) {
    .hero-content h1 {
        font-size: 2.5rem;
    }

    .canvas-container {
        min-height: 300px;
        height: 40vh;
        padding: 1rem;
    }

    .preview-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .modal-content {
        padding: 1.5rem;
    }

    .editable-title-input {
        font-size: 1.25rem;
    }
}

/* Container for the ad to handle positioning */
.ad-container {
    text-decoration: none;
    display: block;
    width: 100%;
    /* Matches your placeholder width */
}

.ad-placeholder {
    position: relative; /* Essential for the overlay to sit on top */
    width: 100%;
    aspect-ratio: 3 / 1;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: var(--transition);
}

.ad-placeholder img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* The dark tint that appears on hover */
.ad-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4); /* Subtle dark tint */
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0; /* Hidden by default */
    transition: var(--transition);
}

/* The Button Styling */
.visit-btn {
    background-color: var(--brand-primary);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: var(--shadow-soft);
    transform: translateY(10px); /* Slight slide up effect */
    transition: var(--transition);
}

/* Hover Effects */
.ad-container:hover .ad-overlay {
    opacity: 1;
}

.ad-container:hover .visit-btn {
    transform: translateY(0);
}

.ad-container:hover .ad-placeholder {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-hover);
}