/*
 * SPVnet 2.0 - VD2025 Custom Modal
 * Modern fullscreen modal with wizard integration
 * Date: 2025-01-03
 */

/* ============================================
   MODAL OVERLAY
   ============================================ */
.vd2025-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px) !important;
    z-index: 10000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    animation: fadeIn 0.3s ease !important;
    box-sizing: border-box !important;
}

.vd2025-modal-overlay * {
    box-sizing: border-box !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ============================================
   MODAL CONTAINER
   ============================================ */
.vd2025-modal-container {
    position: relative !important;
    width: auto !important;
    min-width: 600px !important;
    max-width: calc(100% - 20px) !important;
    height: auto !important;
    max-height: calc(100% - 20px) !important;
    background: #ffffff !important;
    border-radius: 8px !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transition: all 0.3s ease !important;
}

/* Fullscreen mode for declaration step (tables) */
.vd2025-modal-container.vd2025-fullscreen {
    width: calc(100vw - 20px) !important;
    max-width: calc(100vw - 20px) !important;
    height: calc(100vh - 20px) !important;
    max-height: calc(100vh - 20px) !important;
}

/* Fixed size mode for questionnaire step */
.vd2025-modal-container.vd2025-questionnaire {
    width: 950px !important;
    max-width: calc(100vw - 40px) !important;
    height: 775px !important;
    max-height: calc(100vh - 40px) !important;
}

/* ============================================
   LOADING OVERLAY (interno ao modal)
   ============================================ */
.vd2025-loading-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(255, 255, 255, 0.6) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 100 !important;
    border-radius: 8px !important;
}

.vd2025-loading-overlay img {
    content: url("../Images/glass_loader.gif");
    width: 64px !important;
    height: 64px !important;
}

/* Force content to full width in fullscreen mode with proper padding */
.vd2025-modal-container.vd2025-fullscreen .vd2025-modal-body {
    padding: 12px !important;
}

.vd2025-modal-container.vd2025-fullscreen .vd2025-modal-content {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: stretch !important;
}

.vd2025-modal-container.vd2025-fullscreen .vd2025-modal-content > *,
.vd2025-modal-container.vd2025-fullscreen .vd2025-modal-content > * > *,
.vd2025-modal-container.vd2025-fullscreen .vd2025-modal-content > * > * > * {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.vd2025-modal-container.vd2025-fullscreen #wizardContentDiv,
.vd2025-modal-container.vd2025-fullscreen .wizardContentDiv {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 16px !important;
    box-sizing: border-box !important;
}

.vd2025-modal-container.vd2025-fullscreen .wizard-body,
.vd2025-modal-container.vd2025-fullscreen #wizardBody {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
}

.vd2025-modal-container.vd2025-fullscreen .form,
.vd2025-modal-container.vd2025-fullscreen #wizardUpdateDiv,
.vd2025-modal-container.vd2025-fullscreen .row,
.vd2025-modal-container.vd2025-fullscreen .container,
.vd2025-modal-container.vd2025-fullscreen .container-fluid,
.vd2025-modal-container.vd2025-fullscreen [class*="col-"] {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ============================================
   MODAL HEADER
   ============================================ */
.vd2025-modal-header {
    background: linear-gradient(135deg, #35aa47 0%, #2d8b3a 100%) !important;
    padding: 6px 12px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
    flex-shrink: 0 !important;
}

.vd2025-modal-title {
    color: white !important;
    font-size: 22px !important;
    font-weight: 600 !important;
    margin: 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
    letter-spacing: -0.5px !important;
}

.vd2025-modal-close {
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    background: #ee353da3 !important;
    border: none !important;
    color: white !important;
    font-size: 20px !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
}

    .vd2025-modal-close:hover {
        background: #d2151d !important;
        transform: scale(1.05) !important;
    }

.vd2025-modal-close:active {
    transform: scale(0.95) !important;
}

/* ============================================
   WIZARD STEPPER IN BODY
   ============================================ */
body.vd2025-active .vd2025-wizard-stepper {
    background: transparent !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 12px !important;
}

body.vd2025-active .vd2025-steps-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    position: relative !important;
}

/* Step item */
body.vd2025-active .vd2025-step {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    flex: 1 !important;
    position: relative !important;
    z-index: 2 !important;
}

/* Step circle */
body.vd2025-active .vd2025-step-circle {
    width: 36px !important;
    height: 36px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    background: rgba(53, 170, 71, 0.1) !important;
    color: rgba(53, 170, 71, 0.4) !important;
    border: 2px solid rgba(53, 170, 71, 0.2) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin-bottom: 6px !important;
    position: relative !important;
}

/* Active step */
body.vd2025-active .vd2025-step.active .vd2025-step-circle {
    background: rgba(53, 170, 71, 1) !important;
    color: white !important;
    border-color: rgba(53, 170, 71, 1) !important;
    box-shadow: 0 3px 12px rgba(53, 170, 71, 0.4) !important;
    transform: scale(1.1) !important;
}

/* Completed step */
body.vd2025-active .vd2025-step.completed .vd2025-step-circle {
    background: rgba(53, 170, 71, 0.85) !important;
    color: white !important;
    border-color: rgba(53, 170, 71, 0.85) !important;
}

/* Step label */
body.vd2025-active .vd2025-step-label {
    font-size: 10px !important;
    font-weight: 500 !important;
    color: rgba(53, 170, 71, 0.5) !important;
    text-align: center !important;
    text-transform: uppercase !important;
    letter-spacing: 0.3px !important;
    line-height: 1.2 !important;
}

body.vd2025-active .vd2025-step.active .vd2025-step-label {
    color: rgba(53, 170, 71, 1) !important;
    font-weight: 700 !important;
}

body.vd2025-active .vd2025-step.completed .vd2025-step-label {
    color: rgba(53, 170, 71, 0.8) !important;
}

/* Progress line between steps */
body.vd2025-active .vd2025-step:not(:last-child)::after {
    content: "" !important;
    position: absolute !important;
    top: 18px !important;
    left: calc(50% + 18px) !important;
    width: calc(100% - 36px) !important;
    height: 2px !important;
    background: rgba(53, 170, 71, 0.15) !important;
    z-index: 1 !important;
    transition: all 0.4s ease !important;
}

body.vd2025-active .vd2025-step.completed:not(:last-child)::after {
    background: rgba(53, 170, 71, 0.6) !important;
}

/* ============================================
   MODAL BODY
   ============================================ */
.vd2025-modal-body {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 0 !important;
    background: #f8f9fa !important;
    display: flex !important;
    flex-direction: column !important;
}

.vd2025-modal-content {
    width: 100% !important;
    max-width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 12px !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.vd2025-modal-content > * {
    max-width: 100% !important;
    box-sizing: border-box !important;
}

/* Hide original wizard footer (buttons moved to modal footer) */
.vd2025-modal-overlay .wizard-footer {
    display: none !important;
}

/* Hide questionnaire navigation (buttons moved to modal footer) */
.vd2025-modal-overlay .wizard-navigation {
    display: none !important;
}

/* Hide 3 br tags after wizard-header */
.vd2025-modal-overlay .wizard-header + br,
.vd2025-modal-overlay .wizard-header + br + br,
.vd2025-modal-overlay .wizard-header + br + br + br {
    display: none !important;
}

/* Remove padding from columns inside wizard-body */
.vd2025-modal-overlay .wizard-body [class*="col-md-"] {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Wizard body - override default min-height but keep it functional */
.vd2025-modal-overlay .wizard-body {
    padding: 24px !important;
    min-height: 0 !important;
    height: auto !important;
}

/* Wizard body div with id */
.vd2025-modal-overlay #wizardBody {
    width: 100% !important;
    padding: 0 16px !important;
    min-height: 0 !important;
    height: auto !important;
    background: transparent !important;
}

/* Remove styling from container divs but not from content */
.vd2025-modal-overlay #wizardUpdateDiv {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
}

/* Remove unwanted styling from wizard form inside modal */
.vd2025-modal-overlay .form {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
}

/* Remove all card styling inside modal body */
.vd2025-modal-overlay .card,
.vd2025-modal-overlay .panel,
.vd2025-modal-overlay .well,
.vd2025-modal-overlay [class*="card"],
.vd2025-modal-overlay [class*="panel"] {
    background: transparent !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
}

/* FORCE remove ALL shadows from modal body and its children - ALWAYS */
.vd2025-modal-body,
.vd2025-modal-body *,
.vd2025-modal-body *::before,
.vd2025-modal-body *::after {
    box-shadow: none !important;
}

/* Exception: Keep shadow ONLY on #wizardContentDiv */
.vd2025-modal-overlay #wizardContentDiv {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08) !important;
    border-radius: 12px !important;
    overflow: hidden !important;
    background: white !important;
    width: auto !important;
}

/* Remove shadows and styling from common containers */
.vd2025-modal-overlay .card,
.vd2025-modal-overlay .panel,
.vd2025-modal-overlay .well,
.vd2025-modal-overlay [class*="card"],
.vd2025-modal-overlay [class*="panel"],
.vd2025-modal-overlay .form,
.vd2025-modal-overlay .wizard-body,
.vd2025-modal-overlay #wizardBody,
.vd2025-modal-overlay #wizardUpdateDiv,
.vd2025-modal-overlay .vd2025-step-content,
.vd2025-modal-overlay .vd2025-step-body {
    box-shadow: none !important;
}

/* Hide empty p tag at the end of form */
.vd2025-modal-overlay .form > p:last-child:empty {
    display: none !important;
}

/* Validation summary styling - Same as VD2025 info-box */
.alert-vd2025,
.vd2025-modal-overlay .validation-summary-errors {
    background: #fef2f2 !important;
    border-left: 4px solid #dc2626 !important;
    padding: 12px !important;
    border-radius: 6px !important;
    margin-bottom: 20px !important;
    box-shadow: none !important;
}

.alert-vd2025 ul,
.vd2025-modal-overlay .validation-summary-errors ul {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.alert-vd2025 li,
.vd2025-modal-overlay .validation-summary-errors li {
    color: #2d3748 !important;
    font-size: 13px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.alert-vd2025 li::before,
.vd2025-modal-overlay .validation-summary-errors li::before {
    content: "\f06a" !important;
    font-family: "FontAwesome" !important;
    color: #dc2626 !important;
    margin-right: 8px !important;
}

/* Individual field validation messages */
.vd2025-modal-overlay .field-validation-error {
    display: none !important;
}

.vd2025-modal-overlay .field-validation-valid {
    display: none !important;
}

/* Input error state */
.vd2025-modal-overlay .input-validation-error,
.vd2025-modal-overlay .vd2025-dropdown.input-validation-error {
    border-color: #dc2626 !important;
}

/* ============================================
   MODAL FOOTER
   ============================================ */
.vd2025-modal-footer {
    background: white !important;
    border-top: 1px solid #e9ecef !important;
    padding: 12px 16px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.vd2025-button-container {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
}

/* Grupo de botões à esquerda (Voltar) */
.vd2025-left-buttons {
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
}

/* Grupo de botões à direita (Gravar, Validar, Submeter, Avançar) */
.vd2025-right-buttons {
    display: flex !important;
    gap: 10px !important;
    align-items: center !important;
}

/* Estilo do contador de perguntas no questionário */
.vd2025-right-buttons .question-counter {
    margin-right: 10px !important;
    font-size: 14px !important;
    color: #666 !important;
}

/* When only right buttons exist, container aligns to the right */
.vd2025-button-container:has(.vd2025-left-buttons:empty) {
    justify-content: flex-end !important;
}

/* When only one button (no back button), align to right */
.vd2025-button-container:has(> :only-child) {
    justify-content: flex-end !important;
}

.vd2025-modal-footer .btn {
    padding: 12px 32px !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    transition: all 0.2s ease !important;
    border: none !important;
    cursor: pointer !important;
    text-decoration: none !important;
}

.vd2025-modal-footer .btn.default {
    background: #6c757d !important;
    color: white !important;
}

.vd2025-modal-footer .btn.default:hover {
    background: #5a6268 !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3) !important;
}

.vd2025-modal-footer .btn.green {
    background: linear-gradient(135deg, #35aa47 0%, #2d8b3a 100%) !important;
    color: white !important;
}

.vd2025-modal-footer .btn.green:hover {
    background: linear-gradient(135deg, #2d8b3a 0%, #35aa47 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 6px 20px rgba(53, 170, 71, 0.35) !important;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
.vd2025-modal-body::-webkit-scrollbar {
    width: 10px !important;
}

.vd2025-modal-body::-webkit-scrollbar-track {
    background: #f1f1f1 !important;
}

.vd2025-modal-body::-webkit-scrollbar-thumb {
    background: #35aa47 !important;
    border-radius: 5px !important;
}

.vd2025-modal-body::-webkit-scrollbar-thumb:hover {
    background: #2d8b3a !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .vd2025-modal-overlay {
        padding: 10px !important;
    }

    .vd2025-modal-container {
        min-width: auto !important;
        width: calc(100% - 20px) !important;
        max-width: calc(100% - 20px) !important;
        height: auto !important;
        max-height: calc(100% - 20px) !important;
    }

    .vd2025-modal-header,
    .vd2025-modal-body,
    .vd2025-modal-footer {
        padding: 16px !important;
    }

    .vd2025-modal-title {
        font-size: 18px !important;
    }

    .vd2025-step-circle {
        width: 36px !important;
        height: 36px !important;
        font-size: 14px !important;
    }

    .vd2025-step-label {
        font-size: 9px !important;
    }
}

/* ============================================
   OVERRIDE KENDO WINDOW COMPLETELY
   ============================================ */

/* Make Kendo window fullscreen with custom styling */
body.vd2025-active .k-window.vd2025-wizard-window.k-window-maximized {
    width: calc(100% - 40px) !important;
    height: calc(100% - 40px) !important;
    top: 20px !important;
    left: 20px !important;
    border-radius: 16px !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.35) !important;
    border: none !important;
    overflow: hidden !important;
    transform: none !important;
}

/* Kendo window titlebar - modern green header */
body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar {
    background: linear-gradient(135deg, #35aa47 0%, #2d8b3a 100%) !important;
    border: none !important;
    padding: 24px 32px 16px 32px !important;
    border-radius: 16px 16px 0 0 !important;
    min-height: auto !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-title {
    color: white !important;
    font-size: 22px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
    letter-spacing: -0.5px !important;
}

/* Close button modern styling */
body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .k-window-action {
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    transition: all 0.2s ease !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .k-window-action:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.05) !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .k-window-action .k-icon {
    color: white !important;
    font-size: 18px !important;
}

/* Kendo window content */
body.vd2025-active .k-window.vd2025-wizard-window .k-window-content {
    background: #f8f9fa !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
    padding: 0 !important;
}

/* Wizard stepper in Kendo titlebar */
body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-wizard-stepper {
    background: rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px !important;
    margin-top: 16px !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-steps-container {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px !important;
    position: relative !important;
}

/* Step styling in titlebar */
body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-step {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    flex: 1 !important;
    position: relative !important;
    z-index: 2 !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-step-circle {
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-weight: 700 !important;
    font-size: 16px !important;
    background: rgba(255, 255, 255, 0.3) !important;
    color: rgba(255, 255, 255, 0.7) !important;
    border: 3px solid transparent !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin-bottom: 8px !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-step.active .vd2025-step-circle {
    background: white !important;
    color: #35aa47 !important;
    border-color: white !important;
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.4) !important;
    transform: scale(1.1) !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-step.completed .vd2025-step-circle {
    background: rgba(255, 255, 255, 0.95) !important;
    color: #35aa47 !important;
    border-color: rgba(255, 255, 255, 0.95) !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-step-label {
    font-size: 11px !important;
    font-weight: 500 !important;
    color: rgba(255, 255, 255, 0.7) !important;
    text-align: center !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-step.active .vd2025-step-label {
    color: white !important;
    font-weight: 600 !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-step.completed .vd2025-step-label {
    color: rgba(255, 255, 255, 0.9) !important;
}

/* Progress line between steps in titlebar */
body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-step:not(:last-child)::after {
    content: "" !important;
    position: absolute !important;
    top: 22px !important;
    left: calc(50% + 22px) !important;
    width: calc(100% - 44px) !important;
    height: 3px !important;
    background: rgba(255, 255, 255, 0.2) !important;
    z-index: 1 !important;
    transition: all 0.4s ease !important;
}

body.vd2025-active .k-window.vd2025-wizard-window .k-window-titlebar .vd2025-step.completed:not(:last-child)::after {
    background: rgba(255, 255, 255, 0.7) !important;
}
