/**
 * ============================================
 * CUSTOM.CSS - Stili Personalizzati
 * Sistema Gestione Bandi
 * ============================================
 */

/* ============================================
   VARIABILI CSS
   ============================================ */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    
    --font-primary: 'Poppins', sans-serif;
    --transition-speed: 0.3s;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --box-shadow-lg: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ============================================
   RESET E GENERALI
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    color: var(--dark-color);
    background-color: #ffffff;
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    transition: all var(--transition-speed) ease;
}

a:hover {
    text-decoration: none;
    opacity: 0.85;
}

/* ============================================
   NAVBAR
   ============================================ */
.navbar {
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease;
}

.navbar-brand {
    font-weight: 700;
    transition: transform var(--transition-speed) ease;
}

.navbar-brand:hover {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    position: relative;
    padding: 0.5rem 1rem !important;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: all var(--transition-speed) ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 80%;
}

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

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-weight: 500;
    padding: 0.5rem 1.5rem;
    border-radius: var(--border-radius);
    transition: all var(--transition-speed) ease;
    border: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.btn-lg {
    padding: 0.75rem 2rem;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.375rem 1rem;
    font-size: 0.875rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all var(--transition-speed) ease;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-weight: 600;
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background-color: rgba(0, 0, 0, 0.02);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
}

/* Card Hover Effects */
.hover-lift {
    transition: all var(--transition-speed) ease;
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 5px;
    font-size: 0.85rem;
}

.badge i {
    margin-right: 0.25rem;
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--success-color);
    background-color: rgba(40, 167, 69, 0.1);
}

.alert-danger {
    border-left-color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
}

.alert-warning {
    border-left-color: var(--warning-color);
    background-color: rgba(255, 193, 7, 0.1);
}

.alert-info {
    border-left-color: var(--info-color);
    background-color: rgba(23, 162, 184, 0.1);
}

/* ============================================
   FORMS
   ============================================ */
.form-control,
.form-select {
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 0.75rem 1rem;
    transition: all var(--transition-speed) ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.15);
}

.form-control-lg {
    padding: 1rem 1.25rem;
    font-size: 1.1rem;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--dark-color);
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg width="100" height="100" xmlns="http://www.w3.org/2000/svg"><defs><pattern id="grid" width="100" height="100" patternUnits="userSpaceOnUse"><path d="M 100 0 L 0 0 0 100" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    opacity: 0.3;
}

.hero-section > * {
    position: relative;
    z-index: 1;
}

/* ============================================
   FEATURES SECTION
   ============================================ */
.content-section {
    padding: 1.5rem 0;
}

.content-section h4 {
    position: relative;
    padding-bottom: 0.75rem;
}

/* ============================================
   BANDI CARDS
   ============================================ */
.bando-card {
    transition: all var(--transition-speed) ease;
    cursor: pointer;
}

.bando-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--box-shadow-lg);
}

.bando-card .card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    min-height: 3em;
}

.bando-card .card-text {
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sticky-top {
    position: sticky;
    top: 80px;
    z-index: 1020;
}

/* Scrollbar Personalizzata */
.filter-scrollable::-webkit-scrollbar {
    width: 6px;
}

.filter-scrollable::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.filter-scrollable::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

.filter-scrollable::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* ============================================
   TABLES
   ============================================ */
.table {
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--light-color);
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    padding: 1rem;
}

.table tbody tr {
    transition: all var(--transition-speed) ease;
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
}

.table-hover tbody tr {
    cursor: pointer;
}

/* ============================================
   PAGINATION
   ============================================ */
.pagination {
    margin-top: 2rem;
}

.page-link {
    color: var(--primary-color);
    border: 1px solid #dee2e6;
    margin: 0 2px;
    border-radius: 5px;
    transition: all var(--transition-speed) ease;
}

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

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

/* ============================================
   BREADCRUMB
   ============================================ */
.breadcrumb {
    background-color: transparent;
    padding: 0.75rem 0;
    margin-bottom: 1.5rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: "›";
    font-size: 1.2rem;
    color: #6c757d;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* ============================================
   MODALS
   ============================================ */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1rem 1.5rem;
}

/* ============================================
   DROPDOWN
   ============================================ */
.dropdown-menu {
    border: none;
    box-shadow: var(--box-shadow-lg);
    border-radius: var(--border-radius);
    padding: 0.5rem 0;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    transition: all var(--transition-speed) ease;
}

.dropdown-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
}

.dropdown-divider {
    margin: 0.5rem 0;
}

/* ============================================
   FOOTER
   ============================================ */
footer {
    margin-top: auto;
}

footer a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

footer a:hover {
    color: white;
    text-decoration: none;
}

.social-links a {
    display: inline-block;
    width: 40px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1);
    transition: all var(--transition-speed) ease;
}

.social-links a:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

/* ============================================
   BACK TO TOP BUTTON
   ============================================ */
#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    box-shadow: var(--box-shadow-lg);
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

#backToTop:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.6s ease-out;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* ============================================
   LOADING SPINNER
   ============================================ */
.spinner-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border-width: 0.3rem;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-justify {
    text-align: justify;
}

.shadow-sm-hover:hover {
    box-shadow: var(--box-shadow) !important;
}

.border-primary-left {
    border-left: 4px solid var(--primary-color) !important;
}

.bg-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
}

.rounded-lg {
    border-radius: 1rem !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 991.98px) {
    .sticky-top {
        position: relative;
        top: auto;
    }
    
    .hero-section {
        padding: 3rem 0 !important;
    }
    
    .display-5,
    .display-6 {
        font-size: 2rem;
    }
}

@media (max-width: 767.98px) {
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1.5rem;
        font-size: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 575.98px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .display-4,
    .display-5,
    .display-6 {
        font-size: 1.75rem;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .navbar,
    .footer,
    #backToTop,
    .btn,
    .breadcrumb {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #dee2e6 !important;
    }
}

/* ============================================
   DARK MODE SUPPORT (Optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
    /* Implementare se necessario */
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus Visible */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================
   FINE CUSTOM CSS
   ============================================ */