/* ===== Esselunga Brand Colors ===== */
:root {
    --esselunga-red: #011A5C;
    --esselunga-dark-red: #010f3d;
    --esselunga-light-gray: #F5F5F5;
    --esselunga-dark-gray: #333333;
    --esselunga-text: #4A4A4A;
    --esselunga-border: #E0E0E0;
}

/* ===== Base Styles ===== */
html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--esselunga-text);
  background-color: #FAFAFA;
}

/* ===== Header & Navigation ===== */
.esselunga-header {
  background-color: #011A5C;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.navbar-brand {
  padding: 0.5rem 0;
}

.brand-logo {
  width: 160px;
  height: 80px;
}

.brand-text {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--esselunga-red);
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.brand-subtitle {
  font-size: 0.85rem;
  color: var(--esselunga-dark-gray);
  font-weight: 400;
  margin-top: -2px;
}

/* ===== Language Selector ===== */
.language-selector .btn {
  border: 1px solid var(--esselunga-border);
  padding: 0.5rem;
  border-radius: 8px;
  background-color: white;
  transition: all 0.3s ease;
  min-width: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.language-selector .btn:hover {
  background-color: var(--esselunga-light-gray);
  border-color: var(--esselunga-red);
}

.language-selector .dropdown-item {
  padding: 0.6rem 1.2rem;
  transition: background-color 0.2s ease;
}

.language-selector .dropdown-item:hover {
  background-color: var(--esselunga-light-gray);
}

.language-selector .dropdown-item.active {
  background-color: var(--esselunga-red);
  color: white;
}

.language-form {
  margin: 0;
}

.language-form button {
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  cursor: pointer;
}

.flag-icon {
  font-size: 1.3rem;
}

/* Flag Icons Custom Size */
.flag-icon-custom {
  width: 1.5em !important;
  height: 1.5em !important;
  border-radius: 3px;
  display: inline-block;
  vertical-align: middle;
}

.dropdown-item .flag-icon-custom {
  width: 1.3em !important;
  height: 1.3em !important;
}

/* ===== Main Content ===== */
main {
  min-height: calc(100vh - 200px);
  background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
}

.homepage-container {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.page-header {
  text-align: center;
  padding: 2rem 0;
}

.main-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--esselunga-dark-gray);
  margin-bottom: 0;
  line-height: 1.3;
}

.secondary-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--esselunga-dark-gray);
  margin-bottom: 0;
  line-height: 1.3;
}

@media (min-width: 768px) {
  .main-title {
    font-size: 2.5rem;
  }
  
  .secondary-title {
    font-size: 1.8rem;
  }
}

/* ===== Content Cards ===== */
.content-card {
  background: white;
  padding: 2rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border-left: 4px solid var(--esselunga-red);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.content-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.intro-text,
.info-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--esselunga-text);
  margin-bottom: 1rem;
}

.section-title {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--esselunga-dark-gray);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--esselunga-light-gray);
}

/* ===== Lists ===== */
.steps-list {
  padding-left: 1.5rem;
  margin-bottom: 0;
}

.steps-list li {
  font-size: 1rem;
  line-height: 1.8;
  color: var(--esselunga-text);
  margin-bottom: 0.8rem;
  padding-left: 0.5rem;
}

.steps-list li::marker {
  color: var(--esselunga-red);
  font-weight: 600;
}

/* ===== Buttons ===== */
.btn-esselunga,
.btn-primary,
.btn-esselunga:link,
.btn-primary:link,
.btn-esselunga:visited,
.btn-primary:visited {
  background-color: var(--esselunga-red) !important;
  border-color: var(--esselunga-red) !important;
  color: #ffffff !important;
  padding: 0.5rem 2rem;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: 50px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(1, 26, 92, 0.3) !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-esselunga:hover,
.btn-primary:hover {
  background-color: var(--esselunga-dark-red) !important;
  border-color: var(--esselunga-dark-red) !important;
  color: #ffffff !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(1, 26, 92, 0.4) !important;
}

.btn-esselunga:active,
.btn-primary:active,
.btn-esselunga:focus,
.btn-primary:focus,
.btn-esselunga.active,
.btn-primary.active,
.btn-esselunga:focus-visible,
.btn-primary:focus-visible {
  background-color: var(--esselunga-dark-red) !important;
  border-color: var(--esselunga-dark-red) !important;
  color: #ffffff !important;
  transform: translateY(0);
  box-shadow: 0 4px 12px rgba(1, 26, 92, 0.3) !important;
}

/* ===== Video Link ===== */
.video-link {
  display: inline-flex;
  align-items: center;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--esselunga-red);
  text-decoration: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.video-link:hover {
  color: var(--esselunga-dark-red);
  background-color: rgba(227, 6, 19, 0.05);
  text-decoration: none;
}

.video-link i {
  font-size: 1.5rem;
}

/* ===== Footer ===== */
.esselunga-footer {
  background-color: #f8f9fa;
  color: #6c757d;
  padding-left: 4rem;
  margin-top: auto;
  border-top: 1px solid #e9ecef;
}

.esselunga-footer p {
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
}

.footer-logo {
    height: 35px;
    width: auto;
    object-fit: contain;
}


.footer-link {
  color: #6c757d;
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--esselunga-red);
  text-decoration: underline;
}

/* ===== Responsive Design ===== */
@media (max-width: 767px) {
  .content-card {
    padding: 1.5rem;
  }

  .main-title {
    font-size: 1.6rem;
  }

  .secondary-title {
    font-size: 1.3rem;
  }

  .btn-esselunga {
    padding: 0.8rem 2rem;
    font-size: 1rem;
  }

  .brand-text {
    font-size: 1.4rem;
  }

  .brand-logo {
    width: 140px;
  }

  .brand-subtitle {
    font-size: 0.75rem;
  }
}

/* ===== Accessibility ===== */
a:focus,
button:focus {
  outline: 2px solid var(--esselunga-red);
  outline-offset: 2px;
}

/* ===== Print Styles ===== */
@media print {
  .esselunga-header,
  .esselunga-footer,
  .language-selector {
    display: none;
  }
}

/* ===== Application Steps Progress Bar - Modern Style ===== */
.steps-container {
    background: #011A5C;
    padding: 40px 0 60px 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
}

.steps-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 0 20px;
    position: relative;
}

.step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    position: relative;
    min-width: 0;
}

.step-number {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 3px solid rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 22px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 15px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 2;
    backdrop-filter: blur(10px);
}

.step-number::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.4s ease;
}

.step-item.active .step-number {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    border-color: #fff;
    color: #000;
    box-shadow: 0 8px 30px rgba(255, 215, 0, 0.6),
                0 0 0 8px rgba(255, 215, 0, 0.2);
    transform: scale(1.15);
}

.step-item.active .step-number::before {
    background: radial-gradient(circle, rgba(255, 215, 0, 0.3) 0%, transparent 70%);
    animation: pulse 2s infinite;
}

.step-item.completed .step-number {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border-color: #fff;
    color: #fff;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
    transform: scale(1.05);
}

.step-label {
    font-size: 13px;
    text-align: center;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.3;
    padding: 0 5px;
    max-width: 140px;
    word-wrap: break-word;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.step-item.active .step-label {
    color: #fff;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: scale(1.05);
}

.step-item.completed .step-label {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 500;
}

.step-connector {
    position: absolute;
    top: 30px;
    left: 50%;
    right: -50%;
    height: 4px;
    background: rgba(255, 255, 255, 0.25);
    z-index: 1;
    border-radius: 2px;
    transition: all 0.6s ease;
    overflow: hidden;
}

.step-item:last-child .step-connector {
    display: none;
}

.step-connector.completed {
    background: linear-gradient(90deg, #fff 0%, rgba(255, 255, 255, 0.9) 100%);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.step-connector.completed::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: shimmer 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 200%;
    }
}

@media (max-width: 992px) {
    .steps-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch;
    }
    
    .step-item {
        flex: 0 0 140px;
    }
    
    .step-connector {
        right: -70px;
    }
}

@media (max-width: 768px) {
    .steps-container {
        padding: 30px 0 50px 0;
    }
    
    .step-number {
        width: 50px;
        height: 50px;
        font-size: 18px;
    }
    
    .step-item.active .step-number {
        transform: scale(1.1);
    }
    
    .step-item.completed .step-number {
        transform: scale(1);
    }
    
    .step-label {
        font-size: 11px;
        max-width: 110px;
        height: 40px;
    }
    
    .step-connector {
        top: 25px;
        height: 3px;
    }
    
    .step-item {
        flex: 0 0 120px;
    }
}

/* ===== Clickable Steps in Development Mode ===== */
.step-item.clickable {
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

.step-item.clickable:hover {
    text-decoration: none;
    color: inherit;
}

.step-item.clickable:hover .step-number {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

.step-item.clickable.active:hover .step-number {
    transform: scale(1.2);
}

.step-item.clickable.completed:hover .step-number {
    transform: scale(1.15);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.6);
}

/* Indicatore visivo che gli step sono cliccabili in dev mode */
.step-item.clickable:not(.active):not(.completed) .step-number {
    border-color: rgba(255, 255, 255, 0.6);
    background: rgba(255, 255, 255, 0.15);
}

.step-item.clickable:not(.active):not(.completed):hover .step-number {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.8);
}

/* ===== Application Form Container ===== */
.application-container {
    padding: 30px 15px;
}

.welcome-card {
    background: linear-gradient(135deg, #011A5C 0%, #012876 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(1, 26, 92, 0.3);
}

.welcome-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 15px;
}

.welcome-text {
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
}

.info-section {
    background: #fff;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: visible; /* Cambiato da hidden a visible per permettere ai dropdown di uscire */
    transition: all 0.3s ease;
}

.info-section:hover {
    border-color: #011A5C;
    box-shadow: 0 4px 15px rgba(1, 26, 92, 0.1);
}

.application-form .section-title {
    background: #f8f9fa;
    padding: 15px 20px;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #003d82;
    border-bottom: 2px solid #e0e0e0;
}

.info-content {
    padding: 20px;
}

.info-description {
    color: #495057;
    line-height: 1.7;
    margin-bottom: 15px;
}

.info-links {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.info-links li {
    margin-bottom: 8px;
}

.info-link {
    color: #5d98db;
    text-decoration: none;
    transition: all 0.2s ease;
}

.info-link:hover {
    color: #002d62;
    text-decoration: underline;
}

.custom-checkbox {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.custom-checkbox:has(input:checked) {
    background: #e8edf7;
    border-color: #011A5C;
}

.custom-checkbox .form-check-input {
    width: 24px;
    height: 24px;
    cursor: pointer;
    border: 2px solid #011A5C;
}

.custom-checkbox .form-check-input:checked {
    background-color: #28a745;
    border-color: #28a745;
}

.custom-checkbox .form-check-label {
    cursor: pointer;
    margin-left: 10px;
    font-size: 15px;
}

.info-note {
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
}

.form-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
}
.form-navigation-nextbutton {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
    flex-direction: row-reverse;
}
.text-danger {
    display: block;
    margin-top: 5px;
    font-size: 14px;
}
.form-check .form-check-input {
    margin-left: unset !important;
}

@media (max-width: 768px) {
    .welcome-title {
        font-size: 22px;
    }
    
    .welcome-text {
        font-size: 14px;
    }
    
    .form-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-navigation .btn {
        width: 100%;
    }
}

/* ===== reCAPTCHA Styles ===== */
.g-recaptcha {
    display: inline-block;
    margin: 0 auto;
}

/* reCAPTCHA container centering */
.info-content .g-recaptcha {
    transform: scale(1);
    transform-origin: center center;
}

/* Development placeholder styling */
.recaptcha-dev-placeholder {
    border: 2px dashed #ccc;
    background: #f8f9fa;
    border-radius: 4px;
}

/* Responsive reCAPTCHA */
@media (max-width: 500px) {
    .g-recaptcha {
        transform: scale(0.85);
        transform-origin: center center;
    }
}

@media (max-width: 400px) {
    .g-recaptcha {
        transform: scale(0.75);
        transform-origin: center center;
    }
}

/* Alert styling improvements for dev mode */
.alert-warning a {
    color: #856404;
    text-decoration: underline;
    font-weight: 600;
}

.alert-warning a:hover {
    color: #533f03;
}

.alert-warning code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.alert-warning small {
    display: block;
    margin-top: 10px;
    line-height: 1.8;
}

/* ===== CAPTCHA Matematico Styles ===== */
.captcha-container {
    padding: 20px;
    text-align: center;
}

.captcha-question {
    font-size: 16px;
    color: #495057;
    font-weight: 500;
}

.captcha-math-display {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    font-size: 32px;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    min-width: 180px;
    display: inline-block;
    font-family: 'Courier New', monospace;
}

.captcha-equation {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 3px;
}

.captcha-input {
    width: 100px;
    height: 60px;
    font-size: 28px;
    font-weight: bold;
    border: 3px solid #667eea;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
}

.captcha-input:focus {
    border-color: #764ba2;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
    outline: none;
}

.captcha-input:invalid {
    border-color: #dc3545;
}

.captcha-input::placeholder {
    color: #ccc;
    font-size: 24px;
}

/* Animazione per risposta corretta/errata */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.captcha-input.error {
    animation: shake 0.5s;
    border-color: #dc3545;
}

/* Responsive CAPTCHA matematico */
@media (max-width: 768px) {
    .captcha-math-display {
        font-size: 24px;
        padding: 15px 20px;
        min-width: 140px;
    }
    
    .captcha-input {
        width: 80px;
        height: 50px;
        font-size: 22px;
    }
    
    .captcha-question {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .captcha-container .row {
        flex-direction: column;
        gap: 15px;
    }
    
    .captcha-math-display {
        margin-bottom: 10px;
    }
}


.required-symbol {
    font-size: large;
    font-weight: bolder;
    margin-top: -3px;
}
.form-control::placeholder {
    color: #b0b0b0;
    opacity: 1; /* importante per alcuni browser */
}

.section-title {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 30px;
}

    .section-title .chevron-icon {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s ease;
    }

    .section-title.collapsed .chevron-icon {
        transform: translateY(-50%) rotate(-90deg);
    }

.info-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

    .info-content.collapsing {
        transition: height 0.3s ease;
    }


.file-upload-container {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 20px;
}

.file-upload-dropzone {
    text-align: center;
    padding: 40px 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

    .file-upload-dropzone:hover {
        background-color: #f8f9fa;
    }

    .file-upload-dropzone.dragover {
        background-color: #e8edf7;
        border-color: #011A5C;
    }

.file-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 10px;
    background-color: #fff;
    transition: box-shadow 0.3s ease;
}

    .file-item:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }

.file-icon {
    font-size: 2rem;
    color: #6c757d;
}

.file-details {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: #212529;
}

.file-meta {
    font-size: 0.875rem;
}

.remove-file-btn {
    min-width: 40px;
}

.section-title {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 30px;
}

    .section-title .chevron-icon {
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s ease;
    }

    .section-title.collapsed .chevron-icon {
        transform: translateY(-50%) rotate(-90deg);
    }

.info-content {
    transition: all 0.3s ease;
    overflow: hidden;
}

.categories-tree {
    max-height: 400px;
    overflow-y: auto;
}

.category-parent {
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    overflow: hidden;
}

.category-item {
    background-color: #f8f9fa;
}

.category-header {
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: background-color 0.15s ease-in-out;
}

    .category-header:hover {
        background-color: #e9ecef;
    }

.category-name {
    font-weight: 500;
    flex-grow: 1;
}

.toggle-icon {
    transition: transform 0.15s ease-in-out;
}

.subcategories-container {
    background-color: #fff;
}

.subcategory-item {
    padding: 0.5rem 1rem 0.5rem 3rem;
    border-top: 1px solid #e9ecef;
}

    .subcategory-item:hover {
        background-color: #f8f9fa;
    }

.selected-categories-container {
    min-height: 80px;
}

.categories-table {
    margin-bottom: 0;
    border: 1px solid #dee2e6;
}

    .categories-table thead {
        background-color: #3b5998 !important;
        color: white !important;
    }

        .categories-table thead th {
            background-color: #3b5998 !important;
            color: white !important;
            border: none !important;
            border-bottom: 2px solid #2d4373 !important;
            padding: 1rem;
            font-weight: 600;
            vertical-align: middle;
        }

    .categories-table tbody tr {
        cursor: pointer;
        background-color: white;
        transition: background-color 0.15s ease-in-out;
    }

        .categories-table tbody tr:hover {
            background-color: #f8f9fa !important;
        }

    .categories-table tbody td {
        padding: 0.75rem 1rem;
        vertical-align: middle;
    }

    .categories-table tbody tr.selected {
        background-color: #e7f3ff !important;
    }

#deleteSelectedBtn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-confirm {
    min-width: 10rem;
}

/* Modal Header Esselunga Color Override */
.modal .modal-header.bg-primary {
    background-color: #011A5C !important;
}
