/**
 * WOURC Frontend Styles
 * 
 * Custom styles to complement Tailwind CSS for the frontend
 */

/* Custom animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* WOURC specific styles */
.wourc-verification-form {
    animation: fadeIn 0.6s ease-out;
}

.wourc-certificate-container {
    animation: fadeIn 0.8s ease-out;
}

/* Loading states */
.wourc-loading {
    position: relative;
    pointer-events: none;
}

.wourc-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.wourc-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3b82f6;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 11;
}

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

/* Form enhancements */
.wourc-form-group {
    margin-bottom: 1.5rem;
}

.wourc-form-label {
    display: block;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.wourc-form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.wourc-form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.wourc-form-input.error {
    border-color: #ef4444;
}

.wourc-form-input.error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.wourc-form-error {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.wourc-form-success {
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Button styles */
.wourc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    border-radius: 0.5rem;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.wourc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.wourc-btn-primary {
    background-color: #3b82f6;
    color: white;
}

.wourc-btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.wourc-btn-secondary {
    background-color: #6b7280;
    color: white;
}

.wourc-btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 114, 128, 0.3);
}

.wourc-btn-success {
    background-color: #10b981;
    color: white;
}

.wourc-btn-success:hover:not(:disabled) {
    background-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.wourc-btn-danger {
    background-color: #ef4444;
    color: white;
}

.wourc-btn-danger:hover:not(:disabled) {
    background-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Alert styles */
.wourc-alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid;
}

.wourc-alert-success {
    background-color: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.wourc-alert-error {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #991b1b;
}

.wourc-alert-warning {
    background-color: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

.wourc-alert-info {
    background-color: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

/* Card styles */
.wourc-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.wourc-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.wourc-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
}

.wourc-card-body {
    padding: 1.5rem;
}

.wourc-card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* Badge styles */
.wourc-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 9999px;
}

.wourc-badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.wourc-badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.wourc-badge-error {
    background-color: #fee2e2;
    color: #991b1b;
}

.wourc-badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Search form enhancements */
.wourc-search-form {
    position: relative;
}

.wourc-search-toggle {
    margin-bottom: 1rem;
}

.wourc-search-toggle input[type="radio"] {
    margin-right: 0.5rem;
}

.wourc-search-toggle label {
    cursor: pointer;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s;
}

.wourc-search-toggle label:hover {
    background-color: #f3f4f6;
}

.wourc-search-toggle input[type="radio"]:checked + label {
    background-color: #3b82f6;
    color: white;
}

/* File upload styles */
.wourc-file-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.wourc-file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.wourc-file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    background: #f9fafb;
    transition: all 0.2s;
}

.wourc-file-upload:hover .wourc-file-upload-label {
    border-color: #3b82f6;
    background: #eff6ff;
}

.wourc-file-upload.dragover .wourc-file-upload-label {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.02);
}

/* Progress bar */
.wourc-progress {
    width: 100%;
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 0.25rem;
    overflow: hidden;
}

.wourc-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #1d4ed8);
    transition: width 0.3s ease;
    position: relative;
}

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

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

/* Tab styles */
.wourc-tabs {
    border-bottom: 1px solid #e5e7eb;
}

.wourc-tab-button {
    padding: 0.75rem 1rem;
    border-bottom: 2px solid transparent;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.wourc-tab-button:hover {
    color: #374151;
    border-bottom-color: #d1d5db;
}

.wourc-tab-button.active {
    color: #3b82f6;
    border-bottom-color: #3b82f6;
}

.wourc-tab-content {
    padding: 1.5rem 0;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .wourc-certificate-container {
        margin: 1rem;
        border-radius: 0.5rem;
    }
    
    .wourc-verification-form {
        margin: 1rem;
        padding: 1.5rem;
    }
    
    .wourc-btn {
        width: 100%;
        justify-content: center;
    }
    
    .wourc-card-body {
        padding: 1rem;
    }
}

/* Print styles */
@media print {
    .wourc-btn,
    .wourc-search-form,
    .wourc-file-upload,
    .wourc-tabs {
        display: none !important;
    }
    
    .wourc-certificate-container {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .wourc-card {
        box-shadow: none !important;
        border: 1px solid #ccc !important;
    }
    
    body {
        font-size: 12pt !important;
        line-height: 1.4 !important;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    .wourc-certificate-container {
        page-break-inside: avoid;
    }
}

/* Accessibility improvements */
.wourc-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;
}

.wourc-form-input:focus,
.wourc-btn:focus,
.wourc-tab-button:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .wourc-btn-primary {
        background-color: #000;
        border: 2px solid #000;
    }
    
    .wourc-btn-primary:hover {
        background-color: #333;
        border-color: #333;
    }
    
    .wourc-form-input {
        border-width: 2px;
    }
    
    .wourc-card {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .wourc-card {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .wourc-card-header,
    .wourc-card-footer {
        background: #111827;
        border-color: #374151;
    }
    
    .wourc-form-input {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .wourc-form-input:focus {
        border-color: #60a5fa;
    }
    
    .wourc-form-label {
        color: #e5e7eb;
    }
}

