/**
 * WooCommerce Pagamenti Parziali - Frontend Styles
 * 
 * @package WC_Partial_Payments
 * @version 1.0.0
 * @author G Tech Group S.R.L.S.
 * @website https://gtechgroup.it
 */

/* ==========================================================================
   Container principale
   ========================================================================== */

.wcpp-frontend-container {
    margin: 30px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    clear: both;
}

.wcpp-frontend-container * {
    box-sizing: border-box;
}

/* Evita duplicazioni */
.wcpp-frontend-container + .wcpp-frontend-container {
    display: none;
}

/* ==========================================================================
   Titoli
   ========================================================================== */

.wcpp-frontend-title {
    font-size: 24px;
    font-weight: 600;
    color: #2c3338;
    margin: 0 0 24px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f0f1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcpp-section-subtitle {
    font-size: 18px;
    font-weight: 600;
    color: #2c3338;
    margin: 32px 0 16px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcpp-count-badge {
    background: #007cba;
    color: white;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

/* ==========================================================================
   Summary Cards
   ========================================================================== */

.wcpp-payment-summary {
    background: #ffffff;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wcpp-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.wcpp-summary-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 6px;
    transition: transform 0.2s ease;
}

.wcpp-summary-card:hover {
    transform: translateY(-2px);
}

.wcpp-card-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: 50%;
    color: #646970;
    flex-shrink: 0;
}

.wcpp-card-icon svg {
    width: 20px;
    height: 20px;
}

.wcpp-icon-success {
    color: #00a32a;
    background: #e6f7ed;
}

.wcpp-icon-warning {
    color: #dba617;
    background: #fff8e5;
}

.wcpp-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.wcpp-card-label {
    font-size: 13px;
    color: #646970;
    font-weight: 400;
}

.wcpp-card-value {
    font-size: 20px;
    font-weight: 600;
    color: #2c3338;
}

.wcpp-text-success {
    color: #00a32a;
}

.wcpp-text-warning {
    color: #dba617;
}

.wcpp-text-muted {
    color: #a7aaad;
    font-style: italic;
}

/* ==========================================================================
   Progress Bar
   ========================================================================== */

.wcpp-progress-container {
    margin-top: 20px;
}

.wcpp-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.wcpp-progress-label {
    font-size: 14px;
    color: #646970;
    font-weight: 500;
}

.wcpp-progress-percentage {
    font-size: 14px;
    font-weight: 600;
    color: #007cba;
}

.wcpp-progress-bar {
    width: 100%;
    height: 12px;
    background: #e2e4e7;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.wcpp-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #007cba 0%, #005a87 100%);
    border-radius: 6px;
    transition: width 0.3s ease;
    position: relative;
}

.wcpp-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.wcpp-complete-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 12px;
    background: #e6f7ed;
    color: #00a32a;
    border: 1px solid #b8e6c8;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
}

.wcpp-complete-badge svg {
    width: 16px;
    height: 16px;
}

/* ==========================================================================
   Tabella Pagamenti
   ========================================================================== */

.wcpp-payments-history {
    margin-top: 32px;
}

.wcpp-payments-table-wrapper {
    background: white;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wcpp-payments-table {
    width: 100%;
    border-collapse: collapse;
}

.wcpp-payments-table thead {
    background: #f6f7f7;
    border-bottom: 2px solid #e2e4e7;
}

.wcpp-payments-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #2c3338;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wcpp-payments-table tbody tr {
    border-bottom: 1px solid #f0f0f1;
    transition: background-color 0.2s ease;
}

.wcpp-payments-table tbody tr:hover {
    background-color: #f8f9fa;
}

.wcpp-payments-table tbody tr:last-child {
    border-bottom: none;
}

.wcpp-payments-table td {
    padding: 16px;
    font-size: 14px;
    color: #50575e;
}

.wcpp-payment-number {
    width: 50px;
}

.wcpp-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #f0f0f1;
    border-radius: 50%;
    font-weight: 600;
    font-size: 12px;
    color: #646970;
}

.wcpp-payment-amount strong {
    color: #2c3338;
    font-size: 15px;
}

.wcpp-method-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #e7f2fc;
    color: #005a87;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.wcpp-transaction-id {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #f0f0f1;
    padding: 2px 6px;
    border-radius: 3px;
    color: #2c3338;
}

.wcpp-status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.wcpp-status-success {
    background: #e6f7ed;
    color: #00a32a;
}

.wcpp-status-pending {
    background: #fff8e5;
    color: #996800;
}

.wcpp-note-toggle {
    background: transparent;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.wcpp-note-toggle:hover {
    background: #f0f0f1;
    border-color: #007cba;
}

.wcpp-note-toggle svg {
    display: block;
}

/* ==========================================================================
   Mobile Cards (nascosti su desktop)
   ========================================================================== */

.wcpp-payments-mobile {
    display: none;
}

.wcpp-payment-card {
    background: white;
    border: 1px solid #e2e4e7;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.wcpp-payment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f1;
}

.wcpp-payment-card-number {
    font-weight: 600;
    color: #2c3338;
}

.wcpp-payment-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wcpp-payment-card-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

.wcpp-payment-card-row .wcpp-label {
    color: #646970;
    font-weight: 500;
}

.wcpp-payment-card-row code {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    background: #f0f0f1;
    padding: 2px 4px;
    border-radius: 3px;
}

.wcpp-note-text {
    font-style: italic;
    color: #646970;
    font-size: 13px;
}

/* ==========================================================================
   Call to Action
   ========================================================================== */

.wcpp-payment-cta {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    padding: 32px;
    margin-top: 32px;
    box-shadow: 0 4px 6px rgba(102, 126, 234, 0.2);
}

.wcpp-cta-content {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.wcpp-cta-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.wcpp-cta-icon svg {
    color: white;
}

.wcpp-cta-text {
    flex: 1;
    color: white;
}

.wcpp-cta-text h4 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
}

.wcpp-cta-text p {
    margin: 0;
    font-size: 15px;
    opacity: 0.95;
}

.wcpp-pay-button {
    background: white !important;
    color: #667eea !important;
    padding: 12px 24px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    border: none !important;
}

.wcpp-pay-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wcpp-pay-button svg {
    width: 16px;
    height: 16px;
}

/* Info Box */
.wcpp-payment-info {
    background: #fff8e5;
    border: 1px solid #f0e2b5;
    border-radius: 8px;
    padding: 16px;
    margin-top: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.wcpp-info-icon {
    flex-shrink: 0;
    color: #996800;
}

.wcpp-payment-info p {
    margin: 0;
    color: #50575e;
    font-size: 14px;
}

/* ==========================================================================
   Modal
   ========================================================================== */

.wcpp-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.wcpp-modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.wcpp-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e2e4e7;
}

.wcpp-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3338;
}

.wcpp-modal-close {
    background: transparent;
    border: none;
    font-size: 24px;
    color: #646970;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.wcpp-modal-close:hover {
    background: #f0f0f1;
}

.wcpp-modal-body {
    padding: 20px;
}

.wcpp-modal-body p {
    margin: 0;
    color: #50575e;
    line-height: 1.6;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .wcpp-frontend-title {
        font-size: 20px;
    }
    
    .wcpp-summary-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .wcpp-summary-card {
        padding: 12px;
    }
    
    .wcpp-payments-table-wrapper {
        display: none;
    }
    
    .wcpp-payments-mobile {
        display: block;
    }
    
    .wcpp-cta-content {
        flex-direction: column;
        text-align: center;
    }
    
    .wcpp-pay-button {
        width: 100%;
        justify-content: center;
    }
    
    .wcpp-payment-summary {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .wcpp-frontend-container {
        margin: 20px 0;
    }
    
    .wcpp-card-value {
        font-size: 18px;
    }
    
    .wcpp-payment-cta {
        padding: 20px;
    }
    
    .wcpp-cta-text h4 {
        font-size: 18px;
    }
    
    .wcpp-cta-text p {
        font-size: 14px;
    }
}

/* ==========================================================================
   Compatibilità temi
   ========================================================================== */

/* Storefront */
.storefront-full-width-content .wcpp-frontend-container {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* Astra */
.ast-woocommerce-container .wcpp-frontend-container {
    padding: 0;
}

/* OceanWP */
.oceanwp-theme .wcpp-frontend-container {
    clear: both;
}

/* Flatsome */
.flatsome .wcpp-frontend-container {
    margin-top: 30px;
    margin-bottom: 30px;
}

/* Divi */
.et_pb_section .wcpp-frontend-container {
    max-width: 100%;
}

/* Elementor */
.elementor-widget-container .wcpp-frontend-container {
    width: 100%;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .wcpp-payment-cta,
    .wcpp-pay-button,
    .wcpp-note-toggle,
    .wcpp-modal {
        display: none !important;
    }
    
    .wcpp-payments-table-wrapper {
        border: 1px solid #ddd;
        box-shadow: none;
    }
    
    .wcpp-payments-table th,
    .wcpp-payments-table td {
        border: 1px solid #ddd;
    }
    
    .wcpp-progress-fill::after {
        animation: none;
    }
}
