/* =========================================================
   DESIGN TOKENS
========================================================= */

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;

    --bg-gradient: linear-gradient(135deg, #e0e7ff 0%, #f3f4f6 100%);

    --text-main: #1e293b;
    --text-secondary: #64748b;

    --card-bg: rgba(255, 255, 255, 0.95);
    --glass-border: rgba(255, 255, 255, 0.6);

    --success: #10b981;
    --danger: #ef4444;
}

/* =========================================================
   RESET
========================================================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg-gradient);
    color: var(--text-main);
}



/* =========================================================
   APP LAYOUT (UN SOLO SCROLL)
========================================================= */

.app-container {
    max-width: 1400px;
    margin: 2rem auto;      /* centra orizzontalmente */
    min-height: calc(100vh - 4rem);

    display: flex;
    flex-direction: column;

    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 30px 60px -15px rgba(0,0,0,0.12);
}


/* =========================================================
   HEADER (STICKY)
========================================================= */

header {
    position: sticky;
    top: 0;
    z-index: 10;

    padding: 1.5rem 2.5rem;
    background: var(--card-bg);
    backdrop-filter: blur(18px);

    border-bottom: 1px solid rgba(0,0,0,0.05);
}



.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary-color);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* =========================================================
   MAIN CONTENT
========================================================= */

main {
    flex: 1;
    padding: 3rem;

    display: flex;
    justify-content: center;
    align-items: flex-start;
}


/* =========================================================
   UPLOAD SECTION
========================================================= */

#upload-section {
    width: 100%;
    max-width: 900px;

    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

.hero-text h1 {
    font-size: 3rem;
    margin-bottom: 1rem;

    background: linear-gradient(to right, var(--primary-color), #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

/* =========================================================
   FORM
========================================================= */

.lead-form {
    width: 100%;
    max-width: 700px;

    display: flex;
    gap: 2rem;

    margin-bottom: 2rem;
}

.input-group {
    flex: 1;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;

    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-group input {
    width: 100%;
    padding: 0.85rem 1rem;

    font-size: 0.95rem;
    border-radius: 14px;
    border: 1px solid #cbd5e1;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* =========================================================
   UPLOAD BOX
========================================================= */

.upload-box {
    width: 100%;
    max-width: 700px;
    padding: 3.5rem;

    background: white;
    border: 2px dashed #cbd5e1;
    border-radius: 22px;

    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-box:hover,
.upload-box.drag-over {
    border-color: var(--primary-color);
    background: #eef2ff;
}

.icon-cloud {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.browse-link {
    color: var(--primary-color);
    font-weight: 600;
    text-decoration: underline;
}

.file-hint {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.file-name-display {
    margin-top: 1rem;
    font-weight: 600;
    color: var(--primary-color);
}

/* =========================================================
   BUTTONS
========================================================= */

.primary-btn {
    margin-top: 2.5rem;
    padding: 1.1rem 3rem;

    display: flex;
    align-items: center;
    gap: 10px;

    font-size: 1.15rem;
    font-weight: 700;

    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: 16px;

    cursor: pointer;
    transition: all 0.3s ease;

    box-shadow: 0 15px 30px -10px rgba(99, 102, 241, 0.5);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.secondary-btn {
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 0.5rem 1rem;

    cursor: pointer;
    font-weight: 600;
    color: var(--text-secondary);
}

.secondary-btn:hover {
    background: #f1f5f9;
}

/* =========================================================
   DASHBOARD
========================================================= */

#dashboard-section {
    width: 100%;
    max-width: 1200px;

    display: flex;
    flex-direction: column;
    gap: 2rem;

    animation: fadeIn 0.4s ease-out;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#dataset-title {
    font-size: 1.5rem;
    font-weight: 700;
}

/* KPI GRID */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.kpi-card {
    padding: 1.5rem;
    background: white;
    border-radius: 18px;
    box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.08);
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.kpi-value {
    margin-top: 0.3rem;
    font-size: 1.6rem;
    font-weight: 700;
}

.kpi-sub {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.insight-card {
    grid-column: span 3;
}

.insight-header {
    display: flex;
    gap: 0.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* =========================================================
   CHART
========================================================= */

.chart-container {
    padding: 2rem;
    background: white;
    border-radius: 18px;
    box-shadow: 0 10px 25px -10px rgba(0, 0, 0, 0.08);
}

.chart-container canvas {
    width: 100% !important;
    height: 400px !important;
}

/* =========================================================
   UTILITIES
========================================================= */

.hidden {
    display: none !important;
}

/* =========================================================
   ANIMATIONS
========================================================= */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .insight-card {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    body {
        align-items: flex-start;
    }

    .app-container {
        min-height: 100vh;
        border-radius: 0;
    }

    main {
        padding: 2rem 1.5rem;
    }

    .lead-form {
        flex-direction: column;
    }

    .hero-text h1 {
        font-size: 2rem;
    }
}
