/**
 * Frontend Styles for WordPress Barcode Generator
 */

.wp-barcode-generator-frontend {
    max-width: 600px;
    margin: 20px 0;
    padding: 25px;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    font-family: inherit;
}

.barcode-generator-title {
    margin-top: 0;
    margin-bottom: 25px;
    color: #333;
    font-size: 24px;
    font-weight: 600;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.barcode-generator-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.barcode-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.barcode-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.barcode-format {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.barcode-format:focus {
    outline: none;
    border-color: #0073aa;
}

.size-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.size-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: normal !important;
    cursor: pointer;
    padding: 8px 12px;
    border: 2px solid #e1e1e1;
    border-radius: 6px;
    transition: all 0.3s ease;
    background: white;
}

.size-option:hover {
    border-color: #0073aa;
    background: #f8f9fa;
}

.size-option input[type="radio"] {
    margin: 0;
}

.size-option input[type="radio"]:checked + span,
.size-option:has(input[type="radio"]:checked) {
    border-color: #0073aa;
    background: #e3f2fd;
    color: #0073aa;
    font-weight: 600;
}

.form-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 25px;
}

.button {
    padding: 12px 24px;
    border: 2px solid #0073aa;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    background: #0073aa;
    color: white;
    transition: all 0.3s ease;
    font-family: inherit;
}

.button:hover {
    background: #005a87;
    border-color: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.button:active {
    transform: translateY(0);
}

.button:disabled {
    background: #f0f0f0;
    border-color: #ddd;
    color: #999;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.button:disabled:hover {
    background: #f0f0f0;
    border-color: #ddd;
    transform: none;
    box-shadow: none;
}

.barcode-preview-section {
    margin-top: 30px;
    border-top: 2px solid #f0f0f0;
    padding-top: 25px;
}

.barcode-preview {
    text-align: center;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 20px;
    background: #fafafa;
    transition: all 0.3s ease;
}

.barcode-preview:hover {
    border-color: #0073aa;
    background: #f8f9fa;
}

.barcode-preview img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    animation: fadeInScale 0.5s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.preview-placeholder {
    color: #666;
    font-style: italic;
    margin: 0;
    font-size: 16px;
}

.input-counter {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
    text-align: right;
}

.char-count {
    font-weight: 600;
}

.loading-spinner {
    text-align: center;
    padding: 25px;
    color: #666;
    font-size: 16px;
}

.loading-spinner::before {
    content: "";
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
    vertical-align: middle;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    padding: 15px;
    background: #ffebee;
    border: 2px solid #f44336;
    border-radius: 6px;
    color: #c62828;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

.error-message p {
    margin: 0;
    font-weight: 500;
}

.format-suggestions {
    padding: 15px;
    background: #e3f2fd;
    border-left: 4px solid #0073aa;
    border-radius: 0 6px 6px 0;
    margin-bottom: 20px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.format-suggestions p {
    margin: 0;
    color: #0d47a1;
}

.format-suggestion {
    display: inline-block;
    background: #0073aa;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    margin: 3px;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
}

.format-suggestion:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.3);
}

/* Responsive design */
@media (max-width: 600px) {
    .wp-barcode-generator-frontend {
        padding: 20px;
        margin: 15px 0;
    }
    
    .barcode-generator-title {
        font-size: 20px;
        margin-bottom: 20px;
    }
    
    .size-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .size-option {
        justify-content: center;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
    
    .barcode-preview {
        min-height: 150px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .wp-barcode-generator-frontend {
        padding: 15px;
        border-radius: 6px;
    }
    
    .barcode-input {
        padding: 10px;
    }
    
    .button {
        padding: 10px 20px;
        font-size: 13px;
    }
}

/* Accessibility improvements */
.button:focus,
.barcode-input:focus,
.barcode-format:focus,
.format-suggestion:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.size-option:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wp-barcode-generator-frontend {
        border-color: #000;
    }
    
    .barcode-input,
    .barcode-format {
        border-color: #000;
    }
    
    .button {
        border-color: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .button,
    .barcode-input,
    .barcode-format,
    .size-option,
    .barcode-preview,
    .format-suggestion {
        transition: none;
    }
    
    .loading-spinner::before {
        animation: none;
    }
    
    @keyframes fadeInScale,
    @keyframes slideIn,
    @keyframes spin {
        from, to {
            opacity: 1;
            transform: none;
        }
    }
}