/**
 * VetInfo Portal Integration CSS
 *
 * @author    Hostinato
 * @copyright Hostinato
 * @license   Commercial
 */

/* Portal button styling - matches confirm_order button */
#btn-rev-portal {
    display: block;
    margin: 0 auto;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 400;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    
    /* Primary button colors */
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

#btn-rev-portal:hover:not(:disabled) {
    color: #fff;
    background-color: #0069d9;
    border-color: #0062cc;
}

#btn-rev-portal:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

#btn-rev-portal:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

#btn-rev-portal i {
    vertical-align: middle;
    margin-right: 10px;
    font-size: 24px;
}

/* Spin animation for loading icon */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

#btn-rev-portal i.spin {
    animation: spin 1s linear infinite;
}

/* Notification styles */
#vetinfo-notification {
    margin-top: 15px;
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

#vetinfo-notification.alert-success {
    color: #155724;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
}

#vetinfo-notification.alert-danger {
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

#vetinfo-notification.alert-warning {
    color: #856404;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
}

#vetinfo-notification.alert-info {
    color: #004085;
    background-color: #d1ecf1;
    border: 1px solid #bee5eb;
}

/* Portal container styling */
.vetinfo-portal-container {
    padding: 20px;
    margin: 20px 0;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.vetinfo-portal-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #dee2e6;
}

.vetinfo-portal-header h3 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 600;
}

.vetinfo-portal-header p {
    margin: 10px 0 0;
    color: #6c757d;
    font-size: 14px;
}

/* Status indicators */
.vetinfo-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.vetinfo-status.status-pending {
    background-color: #ffeeba;
    color: #856404;
}

.vetinfo-status.status-initialized {
    background-color: #d1ecf1;
    color: #004085;
}

.vetinfo-status.status-validated {
    background-color: #d4edda;
    color: #155724;
}

.vetinfo-status.status-failed {
    background-color: #f8d7da;
    color: #721c24;
}

.vetinfo-status.status-closed {
    background-color: #e9ecef;
    color: #495057;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #btn-rev-portal {
        padding: 0.625rem 1.25rem;
        font-size: 1rem;
        width: 100%;
    }

    .vetinfo-portal-container {
        padding: 15px;
        margin: 15px 0;
    }

    .vetinfo-portal-header h3 {
        font-size: 20px;
    }
    
    /* Remove padding on mobile for card body */
    .inner-wrapper .card .card-body {
        padding: 0 !important;
    }
    #checkout .main-block .form-group {
        margin-left: 0px !important;
    }
    
    /* Add vertical spacing between prescription type radio buttons on mobile */
    #vetinfo-prescription-type-panel .row .col-md-2,
    #vetinfo-prescription-type-panel .row .col-md-6 {
        margin-bottom: 15px;
    }
    
    /* Align radio buttons with text on mobile */
    #vetinfo-prescription-type-panel .form-check-input {
        margin-top: 0.25rem;
        vertical-align: middle;
    }
    
    #vetinfo-prescription-type-panel .form-check-label {
        display: inline-flex;
        align-items: center;
        line-height: 1.2;
    }
    
    /* Add padding top to shopping cart header on mobile */
    .block-header.shopping-cart-header {
        padding-top: 30px !important;
    }

    
}

/* Loading overlay */
.vetinfo-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.vetinfo-loading-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.vetinfo-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.vetinfo-loading-text {
    color: #333;
    font-size: 16px;
    margin: 0;
}

/* Admin configuration styles */
.vetinfo-admin-section {
    margin-bottom: 30px;
}

.vetinfo-admin-section .panel {
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.vetinfo-admin-section .panel-heading {
    background-color: #007bff;
    color: white;
    font-weight: 600;
}

.vetinfo-admin-section .form-group {
    margin-bottom: 20px;
}

.vetinfo-admin-section .help-block {
    font-size: 13px;
    color: #6c757d;
    margin-top: 5px;
}

/* Connection test indicator */
.vetinfo-connection-test {
    margin-top: 10px;
    padding: 10px;
    border-radius: 4px;
    font-size: 14px;
}

.vetinfo-connection-test.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.vetinfo-connection-test.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* VetInfo REV module card styling */
.block-header + .inner-wrapper .card {
    border: none;
    box-shadow: none;
    margin-top: 0 !important;
}

.block-header + .inner-wrapper .card .card-body {
    padding: 0 30px 15px;
}

/* Remove padding from checkout inner-wrapper for REV card
#checkout .inner-wrapper {
    padding: 0;
}*/

/* Order Detail Prescription Styles */
#vetinfo-prescription-wrapper {
    border: 1px solid #dee2e6;
    padding: 25px;
    margin: 20px 0;
}

#vetinfo-prescription-wrapper h3 {
    margin-bottom: 20px;
    font-weight: 600;
}

.prescription-info .row {
    margin-bottom: 15px;
    align-items: center;
}

.rev-number, .rev-pin, .rev-data {
    font-weight: 600;
}

.prescription-actions .btn {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.prescription-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

@media (max-width: 768px) {
    #vetinfo-prescription-wrapper {
        padding: 15px;
    }

    .prescription-info .col-sm-4,
    .prescription-info .col-sm-8 {
        text-align: center;
        margin-bottom: 10px;
    }
}

/* Remove gray background from prescription type header */
#vetinfo-prescription-type-panel .card-header {
    background-color: transparent !important;
    border-bottom: none !important;
    padding-left: 0 !important;
}

/* Remove warning alert styling from instruction alert */
#vetinfo-instruction-alert {
    padding: 0 !important;
    background: none !important;
    border: none !important;
    margin: 0 !important;
    color: #000;
    margin-bottom: 20px !important;

}

#vetinfo-instruction-alert p {
    margin: 0 !important;
}

/* Remove top margin and left padding from prescription type panel */
#vetinfo-prescription-type-panel {
    margin-top: 0 !important;
}

#vetinfo-prescription-type-panel .form-group,
#vetinfo-prescription-type-panel .form-check {
    padding-left: 15px !important;
}

/* Desktop alignment for radio buttons and labels */
#vetinfo-prescription-type-panel .form-check {
    display: flex;
    align-items: center;
}

#vetinfo-prescription-type-panel .form-check-input {
    margin-top: 0;
    margin-right: 8px;
    vertical-align: middle;
}

#vetinfo-prescription-type-panel .form-check-label {
    margin-bottom: 0;
    line-height: 1.5;
    display: flex;
    align-items: center;
}

#checkout .main-block .form-group {
    Padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}


#checkout #tc-container .checkout-block#thecheckout-cart-summary>.inner-area>section>.block-header {
    padding-top:15px !important;
    padding-bottom: 15px !important;
}

#checkout #wrapper {
    padding-top: 0 !important;
}

#checkout #tc-container #thecheckout-cart-summary {
    margin-bottom: 0 !important;
}

/* Veterinarian data styling */
#vet-name, #vet-fiscal-code {
    color: #000 !important;
    font-size: 18px !important;
    font-weight: normal;
    vertical-align: middle;
    line-height: 0.5;
}

/* Ensure veterinarian info rows are vertically centered */
#vetinfo-prescription-type-panel .row.mb-4 {
    align-items: center;
}

#vetinfo-prescription-type-panel .row.mb-4 p {
    margin: 0;
    display: flex;
    align-items: center;
    line-height: 1.5;
}

/* Mobile layout adjustments for veterinarian data */
@media (max-width: 768px) {
    #vetinfo-prescription-type-panel .row.mb-4 .col-md-6 {
        text-align: center;
        margin-bottom: 15px;
    }

    #vet-name, #vet-fiscal-code {
        font-size: 16px !important;
        display: block;
    }
}

/* These elements will be hidden naturally when has-pharmaceutical-products is removed after REV completion */

/* Style for persistent info panel */
#vetinfo-persistent-info {
    background-color: #ffffff !important;
    border-color: #dee2e6 !important;
    border: none !important;
    margin-bottom: 20px !important;
    color: #000000 !important;
}

#vetinfo-persistent-info h5 {
    color: #000000 !important;
    margin-bottom: 10px !important;
}

#vetinfo-persistent-info p {
    margin-bottom: 5px !important;
    color: #000000 !important;
}

/* Style when panel is placed in checkout area */
.checkout-area-2 + #vetinfo-persistent-info,
#thecheckout-wrapper #vetinfo-persistent-info {
    margin: 20px 0 !important;
    padding: 15px !important;
    border-radius: 8px !important;
}

/* Style for REV card when moved to checkout area */
#thecheckout-pharmaceutical-rev.moved-to-checkout {
    margin: 20px 0 !important;
    width: 100% !important;
    max-width: none !important;
}

#thecheckout-pharmaceutical-rev.moved-to-checkout .block-header {
    background: #011586 !important;
    border-bottom: 1px solid #dee2e6 !important;
    margin-bottom: 0 !important;
}

/* Mobile styles for moved REV card header */
@media (max-width: 768px) {
    #thecheckout-pharmaceutical-rev.moved-to-checkout .block-header {
        background: transparent !important;
        border-bottom: none !important;
    }

    /* Remove padding only for veterinarian info panel on mobile */
    #thecheckout-pharmaceutical-rev.moved-to-checkout #vetinfo-persistent-info {
        padding: 0 !important;
    }
}

/* Ensure REV card is always visible when moved to checkout */
.checkout-area-2 + #thecheckout-pharmaceutical-rev,
#thecheckout-wrapper #thecheckout-pharmaceutical-rev {
    display: block !important;
}

/* Scorta Propria */

#vetinfo-scorta-propria-popup .modal-content {
    border: none;
    border-radius: 8px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

#vetinfo-scorta-propria-popup .modal-content.card {
    border: none !important;
    padding-top: 0 !important
}

#vetinfo-scorta-propria-popup .card-header {
    border: none !important;
    border-bottom: none;
    border-radius: 8px 8px 0 0 !important;
    background-color: #011589 !important;
    padding: 15px 20px;
    margin: 0;
}

#vetinfo-scorta-propria-popup .modal-title {
    font-weight: 600;
    font-size: 1.4rem;
    color: #fff !important;
}

#vetinfo-scorta-propria-popup .card-body {
    padding: 20px;
    margin: 0 auto;
}

#vetinfo-scorta-propria-popup .alert {
    border-radius: 8px;
    border: none;
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 0;
    padding: 0 !important;
    color: #000 !important;
    background-color: transparent !important;
}

#vetinfo-scorta-propria-popup .btn-confirm {
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    background-color: #011589 !important;
    border-color: #011589 !important;
    color: #fff !important;
}

#vetinfo-scorta-propria-popup .btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

#vetinfo-scorta-propria-popup .btn-cancel {
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 6px;
    transition: all 0.3s ease;
}

#vetinfo-scorta-propria-popup.fade .modal-dialog {
    transition: transform 0.4s ease-out, opacity 0.4s ease-out;
}

#vetinfo-scorta-propria-popup.show .modal-dialog {
    transform: scale(1);
}

#vetinfo-scorta-propria-popup .modal-dialog {
    transform: scale(0.8);
}

@media (max-width: 768px) {
    #vetinfo-scorta-propria-popup .modal-dialog {
        margin: 15px;
        margin-top: 10vh;
    }

    #vetinfo-scorta-propria-popup .modal-title {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    #vetinfo-scorta-propria-popup .card-body {
        padding: 0.75rem !important;
    }

    #vetinfo-scorta-propria-popup .card-header {
        padding: 0.75rem 1rem !important;
    }

    #vetinfo-scorta-propria-popup .alert {
        font-size: 15px;
        line-height: 1.4;
    }

    #vetinfo-scorta-propria-popup .btn-confirm,
    #vetinfo-scorta-propria-popup .btn-cancel {
        font-size: 14px;
        padding: 10px 20px;
    }

    #vetinfo-scorta-propria-popup .modal-content {
        min-height: 30vh;
        max-width: 43vh;
    }
}
/* ============================================================
   Acquisto con ricetta - blocco ricetta nel riepilogo carrello
   ============================================================ */
.hosvetinfo-prescription-block { width: 100%; margin: 18px 0 8px 0; }
.hosvetinfo-prescription-row { display: flex; gap: 12px; align-items: center; }
.hosvetinfo-prescription-input {
    flex: 1 1 auto; padding: 10px 16px; border: 1.5px solid #e5e7eb;
    font-size: 1.1em; background: #fff; color: #222; outline: none; min-width: 180px;
}
.hosvetinfo-prescription-input:disabled,
.hosvetinfo-prescription-input[readonly] { background: #f8fafc; color: #999; }
.hosvetinfo-prescription-remove-btn {
    background: #0d398a; border: none; width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background 0.18s;
}
.hosvetinfo-prescription-remove-btn:hover { background: #b49728; }
#hosvetinfo-remove-cart-prescription { padding: 0 !important; margin: 0 !important; }
.hosvetinfo-prescription-remove-btn i,
#hosvetinfo-remove-cart-prescription i {
    color: #fff !important; font-size: 16px; top: unset !important; left: unset !important;
}
.hosvetinfo-prescription-warning { display: flex; align-items: flex-start; gap: 12px; margin-top: 28px; }
.hosvetinfo-prescription-warning-icon { display: flex; align-items: center; flex-shrink: 0; }
.hosvetinfo-prescription-warning-icon i { font-size: 24px; color: #0d398a; }
@media screen and (max-width: 767px) { .hosvetinfo-prescription-warning-icon { margin-top: 6px; } }
@media screen and (min-width: 992px) { .hosvetinfo-prescription-warning-icon { margin-top: 6px; } }
.hosvetinfo-prescription-warning-text { font-size: 1em; color: #0d398a; }
.hosvetinfo-prescription-warning-text strong { font-weight: 600; }
.hosvetinfo-prescription-warning-text span { font-weight: 400; }

/* ============================================================
   Checkout: blocca/nasconde il checkout finche' non c'e' il
   collegamento a VetInfo (mostra solo il blocco di connessione)
   ============================================================ */
#onepagecheckoutps.hosvetinfo-checkout-locked > *:not(#hosvetinfo-checkout-auth) { display: none !important; }
.hosvetinfo-checkout-auth { margin: 16px 0; }

/* Checkout - selezione tipo ricetta */
.hosvetinfo-rx-type { margin-top: 10px; }
.hosvetinfo-rx-type .hvc-rx-title { margin-bottom: 6px; }
.hosvetinfo-rx-type .hvc-rx-opt { display: block; margin: 4px 0; cursor: pointer; }
.hosvetinfo-rx-type #hosvetinfo-struct { max-width: 420px; }

/* Banner pagina prodotto (prodotto soggetto a ricetta) */
#aic-product-cart {
    background: #f9f9f9;
    padding: 2rem;
    border: 1px solid #f0f0f0;
}

/* Modal conferma inline (no window.confirm nativo) */
.hosvetinfo-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
}
.hosvetinfo-modal-dialog {
    background: #fff;
    border-radius: 6px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    animation: hosvetinfoModalIn 0.18s ease-out;
}
@keyframes hosvetinfoModalIn {
    from { transform: translateY(-12px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}
.hosvetinfo-modal-header {
    background: #f8d7da;
    color: #842029;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 16px;
    border-bottom: 1px solid #f5c2c7;
}
.hosvetinfo-modal-header i { margin-right: 6px; }
.hosvetinfo-modal-body {
    padding: 18px;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}
.hosvetinfo-modal-footer {
    padding: 12px 18px;
    border-top: 1px solid #eee;
    text-align: right;
    background: #fafafa;
}
.hosvetinfo-modal-footer .btn { margin-left: 8px; }
