/* Nerdify AI Suite - Common Frontend Styles */

/* Common Frontend Utilities */
.nrfy-hidden {
    display: none !important;
}

.nrfy-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;
}

/* Common Loading Animations */
.nrfy-loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #0073aa;
    border-radius: 50%;
    animation: nrfy-spin 1s linear infinite;
}

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

/* Common Button Styles */
.nrfy-btn {
    display: inline-block;
    padding: 8px 16px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-align: center;
}

.nrfy-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.nrfy-btn:active {
    transform: translateY(0);
}

.nrfy-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.nrfy-btn.secondary {
    background: #666;
}

.nrfy-btn.secondary:hover {
    background: #444;
}

.nrfy-btn.success {
    background: #46b450;
}

.nrfy-btn.success:hover {
    background: #3ba549;
}

.nrfy-btn.danger {
    background: #dc3232;
}

.nrfy-btn.danger:hover {
    background: #c12b2b;
}

/* Common Modal Styles */
.nrfy-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.nrfy-modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.nrfy-modal {
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.nrfy-modal-overlay.open .nrfy-modal {
    transform: scale(1) translateY(0);
}

.nrfy-modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nrfy-modal-title {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.nrfy-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
    padding: 4px;
}

.nrfy-modal-close:hover {
    color: #333;
}

.nrfy-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.nrfy-modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Common Form Styles */
.nrfy-form-group {
    margin-bottom: 20px;
}

.nrfy-form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.nrfy-form-input,
.nrfy-form-textarea,
.nrfy-form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.nrfy-form-input:focus,
.nrfy-form-textarea:focus,
.nrfy-form-select:focus {
    border-color: #0073aa;
    outline: none;
}

.nrfy-form-textarea {
    resize: vertical;
    min-height: 80px;
}

.nrfy-form-description {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    font-style: italic;
}

/* Common Alert Styles */
.nrfy-alert {
    padding: 12px;
    border-radius: 4px;
    margin: 15px 0;
    border-left: 4px solid #ddd;
}

.nrfy-alert.info {
    background: #e6f3ff;
    border-left-color: #0073aa;
    color: #004085;
}

.nrfy-alert.success {
    background: #d4edda;
    border-left-color: #46b450;
    color: #155724;
}

.nrfy-alert.warning {
    background: #fff3cd;
    border-left-color: #ffb900;
    color: #856404;
}

.nrfy-alert.error {
    background: #f8d7da;
    border-left-color: #dc3232;
    color: #721c24;
}

/* Common Responsive Utilities */
@media (max-width: 768px) {
    .nrfy-modal {
        margin: 10px;
        max-width: calc(100vw - 20px);
        max-height: calc(100vh - 20px);
    }
    
    .nrfy-modal-header,
    .nrfy-modal-body,
    .nrfy-modal-footer {
        padding: 15px;
    }
    
    .nrfy-modal-footer {
        flex-direction: column;
    }
    
    .nrfy-btn {
        width: 100%;
        margin-bottom: 10px;
    }
}

/* Accessibility */
.nrfy-btn:focus,
.nrfy-form-input:focus,
.nrfy-form-textarea:focus,
.nrfy-form-select:focus {
    outline: 2px solid #005a87;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .nrfy-btn,
    .nrfy-form-input,
    .nrfy-form-textarea,
    .nrfy-form-select {
        border: 2px solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .nrfy-btn,
    .nrfy-modal,
    .nrfy-modal-overlay,
    .nrfy-loading-spinner {
        animation: none;
        transition: none;
    }
}

/* Print styles */
@media print {
    .nrfy-modal-overlay,
    .nrfy-btn {
        display: none;
    }
}

/* Editorial article citations */
.nrfy-source-ref {
    display: inline-flex;
    margin-left: 0.2em;
    vertical-align: super;
    font-size: 0.75em;
    line-height: 1;
}

.nrfy-source-ref a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
}

.nrfy-source-ref a:hover,
.nrfy-source-ref a:focus {
    color: #005a87;
    text-decoration: underline;
}

.nrfy-article-sources {
    margin-top: 2.5rem;
    padding: 1.5rem;
    border: 1px solid #d9e2ec;
    border-radius: 12px;
    background: linear-gradient(180deg, #f8fbfd 0%, #f2f7fb 100%);
}

.nrfy-article-sources__title {
    margin: 0 0 1rem;
    font-size: 1.15rem;
    line-height: 1.3;
}

.nrfy-article-sources__list {
    margin: 0;
    padding-left: 1.25rem;
}

.nrfy-article-sources__item + .nrfy-article-sources__item {
    margin-top: 0.85rem;
}

.nrfy-article-sources__index {
    margin-right: 0.45rem;
    font-weight: 600;
}

.nrfy-article-sources__link {
    color: #0b5cad;
    text-decoration: none;
    word-break: break-word;
}

.nrfy-article-sources__link:hover,
.nrfy-article-sources__link:focus {
    text-decoration: underline;
}

.nrfy-article-sources__host {
    display: block;
    margin-top: 0.2rem;
    color: #52606d;
    font-size: 0.92rem;
}
