/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&family=Roboto:wght@300;400;500;700&display=swap');

:root {
    --primary-color: #4a6baf;
    --primary-dark: #345089;
    --primary-light: #7790c7;
    --secondary-color: #3d9970;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-400: #ced4da;
    --gray-500: #adb5bd;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --font-family-sans-serif: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-family-heading: 'Roboto', -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

/* General Styles */
html, body {
    height: auto !important;
    min-height: 0 !important;
    overflow-x: hidden;
}

body {
    font-family: var(--font-family-sans-serif);
    background-color: var(--light-color);
    color: var(--gray-800);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1 0 auto;
    padding-bottom: 0 !important;
}

/* Fix dropdown overflow issues */
.card {
    overflow: visible !important;
}

.card-body {
    overflow: visible !important;
}

.row {
    overflow: visible !important;
}

.col-md-4, .col-md-8, .col-md-12 {
    overflow: visible !important;
}

.container {
    overflow: visible !important;
}

/* Fix dropdown z-index issues */
.dropdown-menu {
    z-index: 10000 !important;
    position: absolute !important;
}

.btn-group .dropdown-menu {
    z-index: 10000 !important;
    position: absolute !important;
}

.dropdown, .btn-group {
    z-index: 9999 !important;
    position: relative !important;
}

/* Force dropdown to be on top */
.dropdown-menu.show {
    z-index: 10000 !important;
    position: absolute !important;
}
    margin-bottom: 0.5rem !important;
}

.card-body {
    padding: 0.5rem !important;
}

.container, .container-fluid {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
}

.row {
    margin-bottom: 0.25rem !important;
}

.table td, .table th {
    padding: 0.4rem !important;
}

/* Compatta la tabella dei prompt */
.table-responsive {
    margin-bottom: 0 !important;
}

.table {
    margin-bottom: 0 !important;
}

/* Rimuovi spaziatura eccessiva nei form */
.form-group, .mb-3, .mb-4 {
    margin-bottom: 0.35rem !important;
}

/* Rimuovi spazio bianco inutile alla fine delle pagine */
.content-wrapper {
    padding-bottom: 0 !important;
}

/* Riduce spazio nelle breadcrumb */
.breadcrumb {
    padding: 0.25rem 0 !important;
    margin-bottom: 0 !important;
}

/* Rimuove spazio tra i prompt personalizzati */
.col-md-4, .col-md-8 {
    padding: 0.5rem !important;
}

/* Riduci l'altezza della navbar */
.navbar {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
}

/* Riduci lo spazio per la sezione dei prompt */
.py-4, .py-5, .py-3 {
    padding-top: 0.25rem !important;
    padding-bottom: 0.25rem !important;
}

/* Riduci anche spazi verticali */
.my-4, .my-5, .my-3 {
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
}

/* Elimina spazi nell'area bianca vuota */
#settingsContent, #dashboardContent {
    min-height: 0 !important;
}

/* Eliminazione forzata dello spazio bianco vuoto */
.card {
    min-height: 0 !important;
    height: auto !important;
    overflow: hidden !important;
}

/* Rimuovi altezza minima dalle card */
.card-body {
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    overflow: visible;
}

/* Riduci lo spazio bianco nelle card */
.col-md-4 > .card, .col-md-8 > .card {
    margin-bottom: 0.25rem !important;
}

/* Elimina del tutto lo spazio sotto i form */
form {
    margin-bottom: 0 !important;
}

/* Elimina spazio alla fine del container */
.container > .row:last-child {
    margin-bottom: 0 !important;
}

/* Forza l'eliminazione dello spazio sotto le tabelle */
table {
    margin-bottom: 0 !important;
}

/* Forza l'altezza minima a 0 e rimuovi spazi dalla parte inferiore della pagina */
html, body {
    min-height: 0 !important;
}

/* Rimuovi padding da tutte le pagine */
.pt-3, .pt-4, .pt-5, .pb-3, .pb-4, .pb-5 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
    font-weight: 600;
    color: var(--primary-dark);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: all 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.btn-success {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Layout */
.main-content {
    min-height: calc(100vh - 120px);
    padding: 2rem 0;
}

/* Navbar */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: white;
}

.navbar-brand {
    font-weight: 700;
    color: var(--primary-color);
}

.navbar-nav .nav-link {
    font-weight: 500;
}

.navbar-nav .nav-link.active {
    color: var(--primary-color);
}

/* Stile per pulsante nel menu nav - aggiornato */
.navbar-nav .nav-item .btn.btn-primary {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    line-height: 1.5 !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    padding: 8px 15px !important;
    border-radius: 5px !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1) !important;
}

/* Fix per visualizzazione pulsante nel menu - aggiornato */
.navbar-nav li.nav-item {
    display: flex !important;
    align-items: center !important;
    margin: 0 5px !important;
}

/* Hero Section */
.hero {
    background-color: white;
    padding: 4rem 0;
    position: relative;
    overflow: hidden;
}

.hero-text {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.2rem;
    color: var(--gray-600);
    margin-bottom: 2rem;
}

/* Cards */
.card {
    border: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
    height: 100%;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
}

/* Forms */
.form-control {
    border-radius: 4px;
    padding: 0.75rem;
    border: 1px solid var(--gray-300);
}

.form-control:focus {
    box-shadow: 0 0 0 0.2rem rgba(74, 107, 175, 0.25);
    border-color: var(--primary-light);
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-text {
    color: var(--gray-600);
}

/* Alerts */
.alert {
    border-radius: 4px;
    border: none;
}

/* File Upload */
.custom-file-upload {
    border: 2px dashed var(--gray-400);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.custom-file-upload:hover {
    border-color: var(--primary-color);
}

.custom-file-upload i {
    font-size: 2.5rem;
    color: var(--gray-500);
    margin-bottom: 1rem;
}

.drop-area {
    position: relative;
    transition: all 0.3s ease;
}

.drop-area.highlight {
    border-color: var(--primary-color);
    background-color: rgba(74, 107, 175, 0.15);
    box-shadow: 0 0 10px rgba(74, 107, 175, 0.5);
    transform: scale(1.01);
}

/* PDF List */
.pdf-list .pdf-item {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.pdf-list .pdf-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pdf-list .pdf-item .pdf-title {
    font-weight: 600;
    color: var(--gray-800);
}

.pdf-list .pdf-item .pdf-meta {
    color: var(--gray-600);
    font-size: 0.875rem;
}

/* Query Section */
.query-box {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 0;
}

.query-history {
    margin-top: 0;
}

/* Fix per lo spazio bianco */
.card-body {
    padding-bottom: 0.5rem;
}

.query-item {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    clear: both;
    overflow: hidden;
}

.query-question {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.query-response {
    white-space: pre-line;
    background-color: var(--gray-100);
    padding: 1rem;
    border-radius: 4px;
    color: var(--gray-800);
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.query-timestamp {
    color: var(--gray-600);
    font-size: 0.875rem;
    margin-top: 1rem;
}

/* Custom Prompt */
.prompt-card {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    position: relative;
}

.prompt-card.default {
    border-left: 4px solid var(--success-color);
}

.prompt-default-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: var(--success-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* Footer */
footer {
    background-color: white;
    padding: 0.75rem 0;
    border-top: 1px solid var(--gray-200);
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 1000;
}

/* Add padding to body to avoid content being hidden by fixed footer */
body {
    padding-bottom: 50px;
}

.footer-links a {
    color: var(--gray-600);
    margin-right: 1.5rem;
}

.footer-links a:hover {
    color: var(--primary-color);
}

/* Loading Indicator */
.loading {
    display: inline-block;
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* Loading Indicator per query form */
#loading-indicator {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1rem;
}

#loading-indicator .spinner-border {
    width: 2rem;
    height: 2rem;
}

#loading-indicator .progress {
    height: 10px;
    background-color: #e9ecef;
}

#loading-indicator .progress-bar {
    background-color: var(--primary-color);
}

/* Stili per la paginazione */
.pagination {
    margin-bottom: 0;
}

.pagination .page-link {
    color: var(--primary-color);
    border-color: var(--gray-300);
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: var(--gray-500);
}

.pagination .page-link:hover {
    background-color: var(--gray-100);
    border-color: var(--gray-300);
    color: var(--primary-dark);
}

.pagination .page-item.active .page-link:hover {
    background-color: var(--primary-dark);
}

/* Stile per il contatore delle domande */
.text-muted.small {
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .main-content {
        padding: 1rem 0;
    }
}
