:root {
  /* Modern Color Palette */
    /* Brand Colors - Blue & Gold Identity */
    --primary-color: #256cb5; /* Blu Piu Chiaro */
    --accent-color: #d4b24e;  /* Giallo Oro Astacerta */
  --secondary-color: #6c757d;
  --dark-bg: #212529;
  --light-bg: #f8f9fa;
  --text-dark: #212529;
  --text-light: #f8f9fa;
  
  /* Legacy Colors */
  --ml-white-color: #fff;
  --ml-red-color: #dc3545;
  --ml-green-color: #198754;
  --ml-arancione-color: #fd7e14;
  
  /* Glassmorphism */
  --glass-bg: rgba(255, 255, 255, 0.95);
  --glass-border: 1px solid rgba(255, 255, 255, 0.18);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f4f6f9;
    color: var(--text-dark);
    padding-top: 70px; /* Space for fixed navbar */
}

/* Override Bootstrap Primary Colors with Red Brand */
.btn-primary {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

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

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

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.badge.bg-primary {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.badge.bg-primary.bg-opacity-10 {
    background-color: rgba(37, 108, 181, 0.1) !important; /* Reverted to 10% Opacity */
    color: var(--primary-color) !important; /* Text is Primary Blue */
    box-shadow: none;
}

.footer-accent {
    color: var(--accent-color) !important;
}

/* Navbar Toggler - Gold Brand Color */
.navbar-toggler {
    border-color: rgba(212, 178, 78, 0.5);
    padding: 0.5rem 0.75rem;
    transition: all 0.3s ease;
}

.navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(212, 178, 78, 0.25);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%23d4b24e' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e") !important;
    transition: transform 0.3s ease;
}

.navbar-toggler[aria-expanded="true"] .navbar-toggler-icon {
    transform: rotate(90deg);
}

/* Pagination & Table Controls Override - BLUE PRIMARY (Default) */
.page-link {
    color: var(--primary-color) !important;
}

.page-link:hover {
    color: var(--accent-color) !important;
}

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

.bootstrap-table .btn-secondary {
    background-color: var(--light-bg) !important;
    border-color: #dee2e6 !important;
    color: var(--primary-color) !important;
}

.bootstrap-table .btn-secondary:hover, 
.bootstrap-table .btn-secondary.active {
    background-color: var(--primary-color) !important;
    color: white !important;
}

/* Table Header Accent - DEEP DARK BLUE for Professional Look */
.table-accent {
    background-color: #153050 !important; /* Deep Blue Night */
    color: white !important;
    border-color: #2c3e50;
}

.table-accent th {
    background-color: #153050 !important;
    color: white !important;
}


h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
}

/* Increase container width for large monitors */
@media (min-width: 1600px) {
    .container, .container-lg, .container-md, .container-sm, .container-xl, .container-xxl {
        max-width: 1600px !important;
    }
}

/* --- Navbar --- */
.navbar {
    background: #153050; /* Deep Blue Night - Matches Sticky Header */
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 1rem 0;
    transition: all 0.3s ease;
}

.navbar-scrolled {
    background: rgba(21, 48, 80, 0.98); /* Deep Blue with slight transparency */
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    padding: 0.5rem 0;
}

.nav-link {
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.85) !important; /* Brighter text for better contrast on blue */
    transition: color 0.3s;
    position: relative;
}

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

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

.nav-link:hover, .nav-link.active {
    color: var(--accent-color) !important;
}

/* Footer & Social Icons Styling */
footer.bg-dark {
    background-color: #153050 !important; /* Deep Blue Night Override */
}

footer a.text-white:hover {
    color: var(--accent-color) !important;
}

.fab, .fas {
    transition: color 0.3s ease;
}

/* Social Icons specific styling */
footer .fab {
    font-size: 1.2rem;
    color: var(--accent-color); /* Gold Icons by default */
}

footer a:hover .fab {
    color: white; /* White on hover */
}

/* --- Hero Section --- */
.hero-section {
    background: linear-gradient(135deg, #1e2024 0%, #2c3036 100%);
    color: white;
    padding: 100px 0 80px;
    position: relative;
    overflow: hidden;
}

@media (max-width: 768px) {
    .hero-section::before {
        background-size: unset !important; /* Cover full area always */
    }
}
    

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("https://static.astacerta.com/images/hero-bg.png");
    background-position: center 59%; /* Desktop focus */
    background-repeat: no-repeat;
    background-size: cover; /* Cover full area always */
    opacity: 0.3; /* Increased opacity for better visibility */
    z-index: 0;
    pointer-events: none; /* Ensure clicks pass through */
}

@media (max-width: 768px) {
    .hero-section::before {
        background-position: center center; /* Reset for mobile */
    }
}

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

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, #fff, #ccc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.25rem;
    font-weight: 300;
    margin-bottom: 2rem;
    color: rgba(255,255,255,0.8);
}

/* --- Blog Section --- */
.blog-card {
    border: none;
    border-radius: 15px;
    overflow: hidden;
    background: white;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
}

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

/* Universal hover lift effect for cards */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
}

/* Blog Carousel Controls - Outside positioning */
#blogCarousel {
    position: relative;
    padding: 0; /* No padding - arrows fully outside */
}

#blogCarousel .carousel-control-prev,
#blogCarousel .carousel-control-next {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    opacity: 1;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s ease;
}

#blogCarousel .carousel-control-prev {
    left: -60px; /* Outside the carousel */
}

#blogCarousel .carousel-control-next {
    right: -60px; /* Outside the carousel */
}

#blogCarousel .carousel-control-prev:hover,
#blogCarousel .carousel-control-next:hover {
    background: #fff;
    border-color: var(--primary-color);
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

#blogCarousel .carousel-control-prev-icon,
#blogCarousel .carousel-control-next-icon {
    filter: brightness(0) invert(1); /* White icons on red background */
}

#blogCarousel .carousel-control-prev:hover .carousel-control-prev-icon,
#blogCarousel .carousel-control-next:hover .carousel-control-next-icon {
    filter: invert(24%) sepia(79%) saturate(3370%) hue-rotate(342deg) brightness(93%) contrast(88%); /* Red icons on white background */
}

#blogCarousel .carousel-indicators {
    bottom: -50px;
}

#blogCarousel .carousel-indicators button {
    background-color: var(--primary-color);
}

/* Mobile: hide outside arrows, show only indicators */
@media (max-width: 768px) {
    #blogCarousel {
        padding: 0;
    }
    
    #blogCarousel .carousel-control-prev,
    #blogCarousel .carousel-control-next {
        display: none;
    }
}

/* Blog Load More Button - Minimal Design */
.blog-load-more {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    letter-spacing: 0.3px;
}

.blog-load-more:hover {
    color: var(--primary-color);
    transform: translateY(-2px);
}

.blog-load-more:hover i {
    animation: bounce-down 0.6s ease infinite;
}

.blog-load-more::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--accent-color);
    transition: width 0.3s ease;
}

.blog-load-more:hover::after {
    width: 80%;
    background: var(--primary-color);
}

@keyframes bounce-down {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

.blog-img {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

.blog-body {
    padding: 1.5rem;
}

.blog-category {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    display: block;
}

.blog-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.blog-meta {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Article Page Styling */
.article-hero-image {
    width: 100%;
    max-height: 500px;
    object-fit: cover;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #333;
}

.article-content h3 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    color: #2c3e50;
}

.article-content ul, .article-content ol {
    margin-bottom: 1.5rem;
}

.article-content li {
    margin-bottom: 0.5rem;
}

/* Mobile Navbar Styling - Modern & Fast */
/* Mobile Navbar Styling - Modern & Fast */
@media (max-width: 991px) {
    .navbar-collapse {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: #153050; /* Solid Deep Blue */
        padding: 3rem 2rem; /* Balanced Padding (Top/Bottom equal) */
        border-bottom: 1px solid rgba(255,255,255,0.1);
        box-shadow: 0 10px 40px rgba(0,0,0,0.5);
        text-align: center;
        z-index: 1000;
        /* Ensure no layout jump */
        max-height: 85vh;
        overflow-y: auto;
    }
    
    /* Overlay Effect - Fixed on Screen */
    .navbar-collapse.show::before {
        content: '';
        position: fixed;
        top: 70px; /* Below navbar header */
        left: 0;
        width: 100vw;
        height: calc(100vh - 70px);
        background: rgba(255, 255, 255, 0.1); /* Light "frosted" tint */
        backdrop-filter: blur(4px); /* Returns the "offuscato" effect */
        z-index: -1;
        pointer-events: none; /* JS handles click, this is visual only */
        opacity: 0;
        animation: fadeInOverlay 0.3s forwards;
    }

    @keyframes fadeInOverlay {
        to { opacity: 1; }
    }
    
    /* Removed container animation to fix 'bounce/glitch' */
    /* Relying on staggered item animations for the 'slow emotion' feel */
    
    .navbar-nav .nav-item {
        margin: 1rem 0;
        opacity: 0;
        transform: translateY(15px);
        /* Only animate explicitly when open */
    }

    .navbar-collapse.show .navbar-nav .nav-item {
        animation: fadeInUp 0.5s ease-out forwards;
    }
    
    @keyframes fadeInUp {
        to { opacity: 1; transform: translateY(0); }
    }
    
    .navbar-nav .nav-item:nth-child(1) { animation-delay: 0.1s; }
    .navbar-nav .nav-item:nth-child(2) { animation-delay: 0.2s; }
    .navbar-nav .nav-item:nth-child(3) { animation-delay: 0.3s; }
    .navbar-nav .nav-item:nth-child(4) { animation-delay: 0.4s; }
    .navbar-nav .nav-item:nth-child(5) { animation-delay: 0.5s; }
    
    .navbar-nav .btn {
        width: 100%;
        max-width: 250px;
        margin: 1rem auto;
        padding: 0.8rem;
    }
}

/* --- Auction Table Section --- */
.auction-section {
    background: white;
    border-radius: 20px;
    padding: 4rem;
    box-shadow: 0 0 40px rgba(0,0,0,0.03);
    margin-top: -50px; /* Overlap with hero/blog */
    position: relative;
    z-index: 10;
}

.auction-section .d-flex {
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 768px) {
    .auction-section {
        padding: 0.5rem !important;
    }
    .auction-section .d-flex {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 0.5rem;
    }
    
    .auction-section h2 {
        font-size: 1rem;
        margin-bottom: 0 !important;
    }
    
    .auction-section .badge {
        font-size: 0.65rem;
        white-space: nowrap;
    }
    
    /* Remove all padding on mobile for auction section */
    #auctions-section.py-5 {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    
    /* Mobile: Search bar and buttons on same line */
    .bootstrap-table .fixed-table-toolbar {
        display: flex !important;
        flex-wrap: nowrap !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .fixed-table-toolbar .search {
        flex: 1;
        margin-right: 0;
        order: 1;
    }
    
    .fixed-table-toolbar .columns {
        order: 2;
        margin-left: 0;
    }
    
    /* Mobile: Pagination full width */
    .bootstrap-table .fixed-table-pagination {
        width: 100%;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    .fixed-table-pagination .float-left {
        float: none !important;
        width: 100%;
        text-align: right;
    }
    
    .fixed-table-pagination .float-right {
        float: none !important;
        width: 100%;
        text-align: center;
    }
    
    .fixed-table-pagination .pagination {
        justify-content: space-between;
        margin-top: 0.5rem;
        width: 100%;
    }
}

/* --- Legacy & Utility Styles --- */
.m-l-60{ margin-left:60px }
pre{
    background: black;
    color: white;
    height: 100vh;
    padding: 25px;
    overflow-y: scroll;
    border: 1px solid #ccc;
    font-size:20px !important;
}

.rotate { animation: rotation 2s infinite linear; }
@keyframes rotation {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Bootstrap Table Customization */
.fixed-table-loading.table.table-bordered.table-hover.open{
    align-items: baseline !important;
    padding-top: 2rem !important;
}

.verde{
    color: var(--ml-green-color) !important;
    font-weight: bold !important;
    min-width: 115px !important;
    text-align: right !important;
    font-family: 'Digital', sans-serif;
    font-size: x-large;
    padding: 0 6px 0 0 !important;
}

.bg-rosso { background-color: var(--ml-red-color) !important; color: white !important; }
.bg-verde { background-color: var(--ml-green-color) !important; color: white !important; }
.bg-arancione { background-color: var(--ml-arancione-color) !important; color: white !important; }

/* PDF icon color - keep link text blue but icon red */
.fa-file-pdf {
    color: var(--ml-red-color) !important;
}

.preview{
    width: 200px !important;
    height: 200px !important;
    object-fit: cover !important;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

@media (max-width: 768px) {
    .preview{
        width: 130px !important;
        max-height: 130px !important;
    }
    .hero-title { font-size: 2.5rem; }
    
    /* Stack hero buttons vertically on mobile */
    .hero-section .d-flex {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: center !important;
    }
    .hero-section .btn {
        width: 100%;
        max-width: 300px;
    }
}

/* Scroll offset for anchor links to account for fixed navbar */
#hero, #blog, #auctions-section, #footer-contact {
    scroll-margin-top: 80px;
}

/* Digital Font - Ensure it loads properly */
@font-face {
    font-family: 'Digital';
    src: url('https://static.astacerta.com/css/font/digital-7.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

.timer {
    font-family: 'Digital', monospace;
    font-weight: bold;
    float:right;
}


/* .verde em - "Totale con oneri" styling */
.verde em {
    font-size: 0.3em !important;
    float: right !important;
    color: #000 !important;
    font-weight: 300 !important;
    font: 400 13px / 1.3 "Roboto", Arial, "Lucida Grande", sans-serif;
}

.giorni{ font-size: xx-large; padding-right:3px; }
.smalls{ font-size: x-small; }
.fa-clock{
    vertical-align: -webkit-baseline-middle;
    padding-top: 18px !important;
}

/* Back to Top */
#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    transform: scale(0);
    opacity: 0;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}
#backToTop.show { transform: scale(1); opacity: 1; }
#backToTop:hover { background-color: var(--accent-color); transform: scale(1.1); box-shadow: 0 6px 16px rgba(253, 126, 20, 0.4); }

/* Table Fixes */
th[data-field="preview"] { width: 165px; } /* Adjusted for smaller preview */
.bootstrap-table .search .input-group { flex-wrap: nowrap !important; }
.bootstrap-table .search button { width: auto !important; }

/* Pagination Z-Index Fix */
.bootstrap-table > .fixed-table-pagination:last-child { background-color: white; }
.bootstrap-table > .fixed-table-pagination:last-child .pagination {
    position: relative;
    z-index: 9999 !important;
}

/* Sticky header positioning - align below navbar */
.fix-sticky {
    top: 70px !important;
    z-index: 1020 !important; /* Below navbar (1030) */
}

/* Customize pagination text - remove verbose words */
.pagination-info::before {
    content: '' !important;
}

/* Legacy em a style */
em a {
    font-size: 1.8em !important;
}

/* Hide "Visualizzazione" and "elementi" words */
.page-list .btn-group .dropdown-menu {
    min-width: auto;
}

/* Expandable Content */
.expandable-content {
    max-height: 60px;
    overflow: hidden;
    position: relative;
    transition: max-height 0.5s ease-in-out;
}
.expandable-content.expanded { max-height: 500px; }
.expand-toggle {
    cursor: pointer;
    font-weight: bold;
    color: var(--primary-color);
    display: block;
    margin-top: 5px;
}

/* Footer Mobile Layout */
@media (max-width: 768px) {
    /* Keep Link Utili and Social columns side by side on mobile */
    footer .row > div[class*="col-md-2"],
    footer .row > div[class*="col-md-3"][class*="col-lg-2"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
        text-align: left !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 3rem !important;
        padding-right: 3rem !important;
    }
    
    /* Full width for other footer sections */
    footer .row > div:not([class*="col-md-2"]):not([class*="col-lg-2"]) {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        margin-bottom: 1.5rem;
    }
}
