/**
 * Stili CSS per il frontend del plugin API WooCommerce Custom
 * Questi stili vengono caricati solo quando necessario
 */

/* Stili base per eventuali elementi frontend del plugin */
.api-wc-custom-frontend {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: #333;
}

/* Stili per messaggi di stato API */
.api-wc-custom-status {
    padding: 12px 16px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
    border-left: 4px solid;
}

.api-wc-custom-status.success {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.api-wc-custom-status.error {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

.api-wc-custom-status.warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.api-wc-custom-status.info {
    background-color: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

/* Stili per loader/spinner */
.api-wc-custom-loader {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: api-wc-spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes api-wc-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Stili per codice e pre-formattato */
.api-wc-custom-code {
    background: #f4f4f4;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.api-wc-custom-code.json {
    background: #2d3748;
    color: #e2e8f0;
    border-color: #4a5568;
}

/* Stili per pulsanti personalizzati */
.api-wc-custom-button {
    display: inline-block;
    padding: 8px 16px;
    background: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.api-wc-custom-button:hover {
    background: #005a87;
    color: #fff;
    text-decoration: none;
}

.api-wc-custom-button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.api-wc-custom-button.secondary {
    background: #6c757d;
}

.api-wc-custom-button.secondary:hover {
    background: #545b62;
}

.api-wc-custom-button.small {
    padding: 4px 8px;
    font-size: 12px;
}

.api-wc-custom-button.large {
    padding: 12px 24px;
    font-size: 16px;
}

/* Stili per form personalizzati */
.api-wc-custom-form {
    max-width: 600px;
    margin: 20px 0;
}

.api-wc-custom-form .form-group {
    margin-bottom: 16px;
}

.api-wc-custom-form label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
    color: #333;
}

.api-wc-custom-form input[type="text"],
.api-wc-custom-form input[type="email"],
.api-wc-custom-form input[type="password"],
.api-wc-custom-form textarea,
.api-wc-custom-form select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.api-wc-custom-form input:focus,
.api-wc-custom-form textarea:focus,
.api-wc-custom-form select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.2);
}

.api-wc-custom-form .form-help {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* Stili per tabelle responsive */
.api-wc-custom-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.api-wc-custom-table th,
.api-wc-custom-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.api-wc-custom-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.api-wc-custom-table tr:hover {
    background: #f8f9fa;
}

/* Responsive design */
@media (max-width: 768px) {
    .api-wc-custom-table {
        font-size: 14px;
    }
    
    .api-wc-custom-table th,
    .api-wc-custom-table td {
        padding: 8px;
    }
    
    .api-wc-custom-form {
        max-width: 100%;
    }
    
    .api-wc-custom-button {
        width: 100%;
        text-align: center;
    }
}

/* Stili per badge e tag */
.api-wc-custom-badge {
    display: inline-block;
    padding: 2px 8px;
    background: #e9ecef;
    color: #495057;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 12px;
    margin: 0 4px 4px 0;
}

.api-wc-custom-badge.success {
    background: #d4edda;
    color: #155724;
}

.api-wc-custom-badge.error {
    background: #f8d7da;
    color: #721c24;
}

.api-wc-custom-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.api-wc-custom-badge.info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Stili per card/pannelli */
.api-wc-custom-card {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.api-wc-custom-card-header {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.api-wc-custom-card-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.api-wc-custom-card-body {
    color: #666;
    line-height: 1.6;
}

/* Stili per tooltip */
.api-wc-custom-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.api-wc-custom-tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
}

.api-wc-custom-tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #333;
    z-index: 1000;
}

/* Stili per animazioni */
.api-wc-custom-fade-in {
    animation: api-wc-fade-in 0.3s ease-in;
}

@keyframes api-wc-fade-in {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.api-wc-custom-slide-in {
    animation: api-wc-slide-in 0.3s ease-out;
}

@keyframes api-wc-slide-in {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Utility classes */
.api-wc-custom-text-center {
    text-align: center;
}

.api-wc-custom-text-right {
    text-align: right;
}

.api-wc-custom-text-left {
    text-align: left;
}

.api-wc-custom-hidden {
    display: none;
}

.api-wc-custom-visible {
    display: block;
}

.api-wc-custom-margin-top {
    margin-top: 20px;
}

.api-wc-custom-margin-bottom {
    margin-bottom: 20px;
}

.api-wc-custom-padding {
    padding: 20px;
}

/* Stili per accessibilità */
.api-wc-custom-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles per accessibilità */
.api-wc-custom-button:focus,
.api-wc-custom-form input:focus,
.api-wc-custom-form textarea:focus,
.api-wc-custom-form select:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .api-wc-custom-button,
    .api-wc-custom-loader {
        display: none;
    }
    
    .api-wc-custom-card {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .api-wc-custom-code {
        background: #f9f9f9;
        border: 1px solid #000;
    }
}