/* ==========================================================================
   Plugin Convenzioni WooCommerce - Stili Frontend
   ========================================================================== */

/* Bottone Convenzioni
   ========================================================================== */
.convenzioni-button-wrapper {
    margin: 20px 0;
    text-align: center;
}

.convenzioni-button {
    background: #0073aa;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #fff;
    border: none;
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    width: 100%;
    max-width: 100%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.convenzioni-button:hover {
    background: #005a87;
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.convenzioni-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Modal
   ========================================================================== */
.convenzioni-modal {
    display: none;
    position: fixed;
    z-index: 99999999 !important;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(3px);
}

@keyframes fadeIn {
    from { 
        opacity: 0;
    }
    to { 
        opacity: 1;
    }
}

.convenzioni-modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 40px 30px 30px;
    border: none;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    animation: slideDown 0.4s ease;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

@keyframes slideDown {
    from {
        transform: translateY(-50px) scale(0.95);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.convenzioni-close {
    color: #aaa;
    position: absolute;
    right: 15px;
    top: 15px;
    font-size: 32px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.convenzioni-close:hover,
.convenzioni-close:focus {
    color: #000;
    background: rgba(0,0,0,0.05);
}

.convenzioni-modal-content h2 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 24px;
    font-weight: 700;
}

#convenzioni-form {
    margin-top: 25px;
}

#convenzioni-codice-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #ddd;
    border-radius: 6px;
    margin-bottom: 15px;
    text-transform: uppercase;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
    font-weight: 600;
}

#convenzioni-codice-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0,115,170,0.1);
}

#convenzioni-codice-input::placeholder {
    text-transform: none;
    letter-spacing: normal;
    font-family: inherit;
    font-weight: normal;
}

#convenzioni-form button[type="submit"] {
    width: 100%;
    padding: 14px 20px;
    background: #0073aa;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#convenzioni-form button[type="submit"]:hover:not(:disabled) {
    background: #005a87;
    background: linear-gradient(135deg, #005a87 0%, #004666 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#convenzioni-form button[type="submit"]:active:not(:disabled) {
    transform: translateY(0);
}

#convenzioni-form button[type="submit"]:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#convenzioni-error {
    margin-top: 15px;
    padding: 12px 16px;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 6px;
    font-size: 14px;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Header Shop Convenzioni
   ========================================================================== */
.convenzione-shop-header {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    border: 2px solid #0073aa;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 35px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,115,170,0.1);
}

.convenzione-shop-header h2 {
    margin: 0 0 12px 0;
    color: #0073aa;
    font-size: 26px;
    font-weight: 700;
}

.convenzione-shop-header p {
    margin: 0 0 18px 0;
    color: #555;
    font-size: 15px;
    line-height: 1.6;
}

.convenzione-shop-header .button,
.convenzione-shop-header .convenzione-exit {
    background: #dc3545;
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #fff;
    padding: 10px 24px;
    text-decoration: none;
    border-radius: 6px;
    display: inline-block;
    transition: all 0.3s ease;
    font-weight: 600;
    border: none;
    box-shadow: 0 2px 4px rgba(220,53,69,0.2);
}

.convenzione-shop-header .button:hover,
.convenzione-shop-header .convenzione-exit:hover {
    background: #c82333;
    background: linear-gradient(135deg, #c82333 0%, #bd2130 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(220,53,69,0.3);
    color: #fff;
}

/* Accessibilità
   ========================================================================== */
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border-width: 0;
}

/* WooCommerce Info Message Override
   ========================================================================== */
.convenzione-shop-header + .woocommerce-info {
    margin-top: 20px;
}

/* Loading State
   ========================================================================== */
.convenzioni-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.convenzioni-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .convenzioni-modal-content {
        width: 95%;
        margin: 15% auto;
        padding: 35px 20px 25px;
    }
    
    .convenzioni-modal-content h2 {
        font-size: 20px;
    }
    
    .convenzione-shop-header {
        padding: 20px 15px;
    }
    
    .convenzione-shop-header h2 {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .convenzioni-button {
        font-size: 14px;
        padding: 12px 20px;
    }
    
    #convenzioni-codice-input {
        font-size: 14px;
        padding: 12px 14px;
    }
    
    #convenzioni-form button[type="submit"] {
        font-size: 14px;
        padding: 12px 18px;
    }
}

/* Dark Mode Support (opzionale)
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .convenzioni-modal {
        background-color: rgba(0,0,0,0.85);
    }
    
    .convenzioni-modal-content {
        background-color: #1e1e1e;
        color: #e0e0e0;
    }
    
    .convenzioni-modal-content h2 {
        color: #f0f0f0;
    }
    
    #convenzioni-codice-input {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }
    
    #convenzioni-codice-input:focus {
        border-color: #4a9eff;
    }
}

/* Print Styles
   ========================================================================== */
@media print {
    .convenzioni-button-wrapper,
    .convenzioni-modal {
        display: none !important;
    }
}

/* Nascondi autore nella pagina convenzioni */
.page-template-default .woocommerce ul.products li.product .posted_in,
.page-template-default .woocommerce ul.products li.product .author {
    display: none !important;
}