/**
 * TAMER QR Certificate Validator - Frontend Styles
 */

/* Certificate validation page */
.tamer-qr-validation-page {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

.tamer-qr-header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 8px;
}

.tamer-qr-header h1 {
    margin: 0 0 10px 0;
    font-size: 28px;
    font-weight: 700;
}

.tamer-qr-header p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}

.tamer-qr-header .website-badge {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    margin-top: 15px;
    font-weight: 500;
}

/* Validation form */
.tamer-qr-validation-form {
    background: #fff;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.tamer-qr-validation-form h2 {
    margin: 0 0 20px 0;
    color: #23282d;
    font-size: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #23282d;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 16px;
    font-family: 'Courier New', monospace;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group .help-text {
    font-size: 14px;
    color: #666;
    margin-top: 5px;
}

.validate-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 14px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.validate-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.validate-button:active {
    transform: translateY(0);
}

.validate-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.validate-button .spinner {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.validate-button.loading .spinner {
    display: block;
}

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

/* Validation results */
.tamer-qr-result {
    border-radius: 8px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    display: none;
}

.tamer-qr-result.valid {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    border: 2px solid #48bb78;
}

.tamer-qr-result.invalid {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border: 2px solid #f56565;
}

.result-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.result-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
}

.tamer-qr-result.valid .result-icon {
    background: #48bb78;
}

.tamer-qr-result.invalid .result-icon {
    background: #f56565;
}

.result-title h3 {
    margin: 0 0 5px 0;
    font-size: 22px;
}

.tamer-qr-result.valid .result-title h3 {
    color: #2f855a;
}

.tamer-qr-result.invalid .result-title h3 {
    color: #c53030;
}

.result-title p {
    margin: 0;
    color: #666;
    font-size: 14px;
}

/* Certificate details */
.certificate-details {
    background: rgba(255,255,255,0.8);
    border-radius: 6px;
    padding: 25px;
    margin-top: 20px;
}

.certificate-details h4 {
    margin: 0 0 20px 0;
    color: #23282d;
    font-size: 18px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e5e9;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.detail-item {
    background: #fff;
    padding: 16px;
    border-radius: 6px;
    border: 1px solid #e1e5e9;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.detail-label {
    display: block;
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    font-weight: 600;
}

.detail-value {
    font-size: 16px;
    color: #23282d;
    font-weight: 500;
    word-break: break-word;
}

.detail-value.score {
    display: inline-block;
    background: #667eea;
    color: #fff;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 14px;
    font-weight: 600;
}

.detail-value.certificate-id {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    background: #f8f9fa;
    padding: 8px 10px;
    border-radius: 4px;
    border: 1px solid #e1e5e9;
}

/* Verification badge */
.verification-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px;
    border-radius: 8px;
    margin-top: 25px;
    text-align: center;
}

.verification-badge .shield-icon {
    font-size: 32px;
    margin-bottom: 10px;
    display: block;
}

.verification-badge h5 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 700;
}

.verification-badge p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.verification-badge .website-link {
    color: #fff;
    text-decoration: underline;
    font-weight: 600;
}

.verification-badge .website-link:hover {
    text-decoration: none;
}

/* Invalid certificate details */
.invalid-reasons {
    background: rgba(255,255,255,0.8);
    border-radius: 6px;
    padding: 20px;
    margin-top: 20px;
}

.invalid-reasons h4 {
    margin: 0 0 15px 0;
    color: #c53030;
    font-size: 16px;
}

.invalid-reasons ul {
    margin: 0 0 20px 0;
    padding-left: 20px;
}

.invalid-reasons li {
    color: #666;
    margin-bottom: 8px;
    line-height: 1.5;
}

.contact-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 4px;
    border-left: 4px solid #667eea;
}

.contact-info p {
    margin: 0;
    font-size: 14px;
    color: #666;
}

.contact-info strong {
    color: #23282d;
}

/* QR code display */
.qr-code-display {
    text-align: center;
    margin: 30px 0;
}

.qr-code-display img {
    max-width: 200px;
    height: auto;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.qr-code-caption {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}

/* Actions */
.result-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.action-button {
    background: #fff;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.action-button:hover {
    background: #667eea;
    color: #fff;
    text-decoration: none;
}

.action-button.secondary {
    border-color: #e1e5e9;
    color: #666;
}

.action-button.secondary:hover {
    background: #f8f9fa;
    border-color: #ccd0d4;
    color: #23282d;
}

/* Responsive design */
@media (max-width: 768px) {
    .tamer-qr-validation-page {
        margin: 20px auto;
        padding: 0 15px;
    }
    
    .tamer-qr-header {
        padding: 20px;
    }
    
    .tamer-qr-header h1 {
        font-size: 24px;
    }
    
    .tamer-qr-validation-form {
        padding: 20px;
    }
    
    .tamer-qr-result {
        padding: 20px;
    }
    
    .result-header {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .details-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .result-actions {
        justify-content: center;
    }
    
    .action-button {
        flex: 1;
        justify-content: center;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    .tamer-qr-header h1 {
        font-size: 20px;
    }
    
    .tamer-qr-header p {
        font-size: 14px;
    }
    
    .validate-button {
        width: 100%;
        justify-content: center;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .action-button {
        width: 100%;
    }
}

/* Print styles */
@media print {
    .tamer-qr-validation-page {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .tamer-qr-validation-form,
    .result-actions {
        display: none !important;
    }
    
    .tamer-qr-result {
        display: block !important;
        box-shadow: none;
        border: 2px solid #000 !important;
        background: #fff !important;
        page-break-inside: avoid;
    }
    
    .tamer-qr-header {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000;
    }
    
    .verification-badge {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000;
    }
}

/* Loading states */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    display: none;
}

.loading-content {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    color: #23282d;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

/* Animation classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Error messages */
.error-message {
    background: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    display: none;
}

.error-message.show {
    display: block;
    animation: slideUp 0.3s ease-out;
}

.success-message {
    background: #f0fff4;
    border: 1px solid #9ae6b4;
    color: #2f855a;
    padding: 15px;
    border-radius: 6px;
    margin: 20px 0;
    display: none;
}

.success-message.show {
    display: block;
    animation: slideUp 0.3s ease-out;
}

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

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-link:focus {
    top: 6px;
}

/* Focus styles */
.validate-button:focus,
.action-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

input:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .tamer-qr-result.valid {
        background: #fff;
        border-color: #000;
    }
    
    .tamer-qr-result.invalid {
        background: #fff;
        border-color: #000;
    }
    
    .validate-button,
    .verification-badge {
        background: #000 !important;
        color: #fff !important;
    }
}