/* Potentiel IRVE CSS */
/* Reusing root variables from Business_Projections */
:root {
    --bg-slate-950: #020617;
    --text-slate-200: #e2e8f0;
    --text-slate-400: #94a3b8;
    --text-slate-500: #64748b;
    --text-slate-600: #475569;
    --text-white: #ffffff;
    --cyan-500: #06b6d4;
    --cyan-400: #22d3ee;
    --cyan-600: #0891b2;
    --blue-500: #3b82f6;
    --red-500: rgba(239, 68, 68, 0.5);
    --white-5: rgba(255, 255, 255, 0.05);
    --white-10: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
}

.page-potentiel-irve {
    background-color: var(--bg-slate-950);
    color: var(--text-slate-200);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    padding: 2rem;
}

.pi-container {
    max-width: 80rem; /* max-w-7xl */
    margin-left: auto;
    margin-right: auto;
}

/* Header */
.pi-header {
    margin-bottom: 3rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
}

.pi-header-left h1 {
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--text-white);
    margin-bottom: 0.5rem;
}

.pi-header-left p {
    color: var(--text-slate-500);
}

.pi-header-right {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.pi-nav-btn {
    background-color: var(--white-5);
    border: 1px solid var(--white-10);
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    color: var(--text-slate-200);
    font-size: 0.875rem;
    font-weight: 700;
    transition: all 0.3s ease;
    text-decoration: none;
}
.pi-nav-btn:hover {
    background-color: rgba(6, 182, 212, 0.1);
    color: var(--cyan-400);
}

.pi-search-box {
    background-color: #0f172a; /* slate-900 */
    border: 1px solid var(--white-10);
    border-radius: 0.75rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    transition: border-color 0.3s ease;
}
.pi-search-box:focus-within {
    border-color: rgba(6, 182, 212, 0.5);
}
.pi-search-box input {
    background: transparent;
    border: none;
    outline: none;
    padding: 0.5rem;
    font-size: 0.875rem;
    width: 16rem;
    color: var(--text-slate-200);
}
.pi-search-box .material-symbols-outlined {
    padding: 0 0.5rem;
    color: var(--text-slate-500);
}

/* Glass Table Container */
.glass-table-container {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Table */
.pi-table {
    width: 100%;
    text-align: left;
    border-collapse: collapse;
}

.pi-table thead tr {
    background-color: var(--white-5);
}
.pi-table thead th {
    padding: 1.25rem 1rem;
    color: var(--slate-300);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.pi-table thead th::after {
    content: '';
    margin-left: 0.5rem;
    font-size: 1rem;
    color: var(--cyan-400);
    opacity: 0.5;
}

.pi-table thead th.sort-asc::after {
    content: ' \2191';
    opacity: 1;
}

.pi-table thead th.sort-desc::after {
    content: ' \2193';
    opacity: 1;
}

.pi-table thead th:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.03);
}
.pi-table thead th.text-right {
    text-align: right;
}
.pi-table thead th.text-center {
    text-align: center;
}
.pi-table thead th.sortable-active {
    color: var(--cyan-500);
}

.pi-table tbody tr {
    border-bottom: 1px solid var(--white-5);
    transition: background-color 0.2s ease;
}
.pi-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.pi-table tbody td {
    padding: 1.5rem;
    font-variant-numeric: tabular-nums;
}
.pi-table tbody td.text-right {
    text-align: right;
}
.pi-table tbody td.text-center {
    text-align: center;
}
.pi-table tbody td.city-name {
    font-weight: 700;
    color: var(--text-white);
}
.pi-table tbody td.city-zip {
    color: var(--text-slate-500);
}
.pi-table tbody td.bornes-zero {
    color: var(--red-500);
}
.pi-table tbody td.score {
    font-weight: 900;
    color: var(--cyan-400);
}

.pi-action-btn {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: -0.05em;
    background-color: var(--white-5);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    color: var(--text-slate-200);
    text-decoration: none;
    transition: all 0.2s ease;
}
.pi-table tbody tr:hover .pi-action-btn {
    background-color: var(--cyan-600);
    color: var(--text-white);
}

/* Footer note */
.pi-footer-note {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-slate-500);
    text-align: center;
}

/* Load More Button */
.pi-load-more-container {
    display: flex;
    justify-content: center;
    margin: 3rem 0;
}

.pi-load-more-btn {
    display: none; /* Managed by JS */
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2.5rem;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--cyan-400);
    border-radius: var(--radius-xl); /* Assuming --radius-xl is defined elsewhere or will be added */
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pi-load-more-btn:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--cyan-400);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(6, 182, 212, 0.5);
}

.pi-load-more-btn .material-symbols-outlined {
    font-size: 1.25rem;
}

/* Sort Icon */
.sort-icon {
    font-size: 0.75rem;
    margin-left: 0.25rem;
    vertical-align: middle;
}

/* Responsive */
@media (max-width: 900px) {
    .pi-header-left h1 {
        font-size: 1.5rem !important;
    }
}

@media (max-width: 768px) {
    .page-potentiel-irve {
        padding: 1rem !important;
    }
    
    .pi-container {
        width: 100% !important;
        overflow-x: hidden;
    }

    .pi-table thead th,
    .pi-table tbody td {
        padding: 0.75rem 0.5rem;
    }
    .pi-table thead th {
        font-size: 0.5rem;
    }
    .pi-table tbody td {
        font-size: 0.75rem;
    }
    
    /* Permettre le scroll du tableau sans casser le layout */
    .glass-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.5rem;
        border-radius: 1rem;
    }
    
    .pi-table {
        min-width: 600px; /* Force le scroll horizontal sur petit écran */
    }

    .pi-action-btn {
        padding: 0.15rem 0.5rem;
        font-size: 0.5rem;
    }
    .pi-header-left h1 {
        font-size: 1.5rem;
    }
    .pi-header-left p {
        font-size: 0.8rem;
    }
    .pi-nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    .pi-search-box {
        width: 100%;
    }
    .pi-search-box input {
        width: 100%;
        font-size: 0.8rem;
    }
    
    /* Formulaire Pro Responsivité */
    .pi-pro-lead {
        padding: 1.5rem !important;
    }
    
    .pi-pro-lead h2 {
        font-size: 1.4rem !important;
    }

    .pi-pro-lead form {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
    }
    
    .pi-pro-lead form > div {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        grid-template-columns: none !important; /* Brise le grid inline de PHP */
    }

    .pi-pro-lead form input, 
    .pi-pro-lead form select, 
    .pi-pro-lead form button {
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .pi-load-more-btn {
        padding: 0.75rem 1.5rem;
        font-size: 0.875rem;
    }
    .pi-load-more-btn .material-symbols-outlined {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .pi-header-left h1 {
        font-size: 1.3rem !important;
    }
}
