/**
 * UNA Fact Checker - Styles
 * 
 * Professional modal and UI styling for fact-checking tool
 *
 * @package UNA_Fact_Checker
 * @since 1.0.0
 */

/* ==========================================================================
   Google Fonts - Tajawal
   ========================================================================== */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@200;300;400;500;700;800;900&display=swap');

/* ==========================================================================
   CSS Variables (matching UNA AI Tools)
   ========================================================================== */
:root {
    --una-fc-font-family: 'Tajawal', sans-serif;
    --una-fc-primary: #08715b;
    --una-fc-primary-hover: #065c49;
    --una-fc-primary-light: #e8f5f1;
    --una-fc-secondary: #2c3e50;
    --una-fc-success: #27ae60;
    --una-fc-success-light: #d4edda;
    --una-fc-warning: #f39c12;
    --una-fc-error: #e74c3c;
    --una-fc-error-light: #f8d7da;
    --una-fc-gray-100: #f8f9fa;
    --una-fc-gray-200: #e9ecef;
    --una-fc-gray-300: #dee2e6;
    --una-fc-gray-400: #ced4da;
    --una-fc-gray-500: #adb5bd;
    --una-fc-gray-600: #6c757d;
    --una-fc-gray-700: #495057;
    --una-fc-gray-800: #343a40;
    --una-fc-gray-900: #212529;
    --una-fc-white: #ffffff;
    --una-fc-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --una-fc-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --una-fc-shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);
    --una-fc-shadow-xl: 0 12px 40px rgba(0, 0, 0, 0.2);
    --una-fc-radius-sm: 4px;
    --una-fc-radius-md: 8px;
    --una-fc-radius-lg: 12px;
    --una-fc-radius-xl: 16px;
    --una-fc-transition: all 0.3s ease;
}

/* ==========================================================================
   Global Base Styles
   ========================================================================== */
[class^="una-fc-"],
[class*=" una-fc-"] {
    font-family: var(--una-fc-font-family);
    box-sizing: border-box;
}

/* ==========================================================================
   Floating Trigger Button (appears under chatbot)
   ========================================================================== */
#una-fc-trigger {
    position: fixed;
    bottom: 100px;
    right: 35px;
    left: auto;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--una-fc-primary), var(--una-fc-primary-hover));
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--una-fc-shadow-lg);
    transition: var(--una-fc-transition);
    animation: unaFcPulse 2s infinite;
}

#una-fc-trigger:hover {
    transform: scale(1.1);
    box-shadow: var(--una-fc-shadow-xl);
    animation: none;
}

#una-fc-trigger svg {
    width: 26px;
    height: 26px;
    fill: var(--una-fc-white);
}

#una-fc-trigger .una-fc-tooltip {
    position: absolute;
    right: 60px;
    left: auto;
    background: var(--una-fc-gray-900);
    color: var(--una-fc-white);
    padding: 8px 12px;
    border-radius: var(--una-fc-radius-sm);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--una-fc-transition);
}

#una-fc-trigger:hover .una-fc-tooltip {
    opacity: 1;
    visibility: visible;
}

@keyframes unaFcPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(8, 113, 91, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(8, 113, 91, 0);
    }
}

/* ==========================================================================
   Shortcode Button
   ========================================================================== */
.una-fc-shortcode-btn {
    font-family: var(--una-fc-font-family);
    background: linear-gradient(135deg, var(--una-fc-primary), var(--una-fc-primary-hover));
    border: none;
    color: var(--una-fc-white);
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: var(--una-fc-radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: var(--una-fc-transition);
    box-shadow: var(--una-fc-shadow-md);
}

.una-fc-shortcode-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--una-fc-shadow-lg);
}

.una-fc-shortcode-btn .una-fc-icon {
    width: 20px;
    height: 20px;
}

/* ==========================================================================
   Modal Overlay
   ========================================================================== */
.una-fc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 100001;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.una-fc-overlay.active {
    display: flex;
    opacity: 1;
}

/* ==========================================================================
   Modal Container
   ========================================================================== */
.una-fc-modal {
    font-family: var(--una-fc-font-family);
    background: var(--una-fc-white);
    border-radius: var(--una-fc-radius-xl);
    box-shadow: var(--una-fc-shadow-xl);
    width: 100%;
    max-width: 850px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    direction: rtl;
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.una-fc-overlay.active .una-fc-modal {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ==========================================================================
   Modal Header
   ========================================================================== */
.una-fc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--una-fc-gray-200);
    background: linear-gradient(135deg, var(--una-fc-primary), var(--una-fc-primary-hover));
}

.una-fc-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.una-fc-logo {
    width: 40px;
    height: 40px;
    background: var(--una-fc-white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
}

.una-fc-logo svg {
    width: 24px;
    height: 24px;
    stroke: var(--una-fc-primary);
    fill: none;
}

.una-fc-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--una-fc-white);
}

.una-fc-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--una-fc-white);
    transition: var(--una-fc-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.una-fc-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ==========================================================================
   Modal Body
   ========================================================================== */
.una-fc-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Info Box */
.una-fc-info-box {
    background: var(--una-fc-primary-light);
    border: 1px solid rgba(8, 113, 91, 0.2);
    border-radius: var(--una-fc-radius-md);
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.una-fc-info-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    color: var(--una-fc-primary);
}

.una-fc-info-text {
    margin: 0;
    font-size: 15px;
    color: var(--una-fc-primary);
    line-height: 1.8;
}

/* ==========================================================================
   Input Form
   ========================================================================== */
.una-fc-form {
    margin-bottom: 20px;
}

.una-fc-input-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--una-fc-secondary);
    margin-bottom: 10px;
}

.una-fc-textarea {
    width: 100%;
    min-height: 160px;
    padding: 18px;
    border: 2px solid var(--una-fc-gray-300);
    border-radius: var(--una-fc-radius-md);
    font-family: var(--una-fc-font-family);
    font-size: 16px;
    line-height: 1.9;
    resize: vertical;
    transition: var(--una-fc-transition);
    direction: rtl;
}

.una-fc-textarea:focus {
    outline: none;
    border-color: var(--una-fc-primary);
    box-shadow: 0 0 0 4px rgba(8, 113, 91, 0.1);
}

.una-fc-textarea::placeholder {
    color: var(--una-fc-gray-500);
}

.una-fc-char-count {
    text-align: left;
    font-size: 12px;
    color: var(--una-fc-gray-500);
    margin-top: 8px;
}

/* Check Button */
.una-fc-check-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--una-fc-primary), var(--una-fc-primary-hover));
    border: none;
    border-radius: var(--una-fc-radius-md);
    color: var(--una-fc-white);
    font-family: var(--una-fc-font-family);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: var(--una-fc-transition);
    box-shadow: var(--una-fc-shadow-md);
    margin-top: 16px;
}

.una-fc-check-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--una-fc-shadow-lg);
}

.una-fc-check-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.una-fc-check-btn svg {
    width: 22px;
    height: 22px;
}

/* ==========================================================================
   Loading State
   ========================================================================== */
.una-fc-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    text-align: center;
}

.una-fc-loading.visible {
    display: flex;
}

/* Animated Loader */
.una-fc-loader {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
}

.una-fc-loader-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: var(--una-fc-primary);
    border-radius: 50%;
    animation: unaFcSpin 1.2s linear infinite;
}

.una-fc-loader-circle:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-top-color: var(--una-fc-success);
    animation-duration: 1s;
    animation-direction: reverse;
}

.una-fc-loader-circle:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 20px;
    left: 20px;
    border-top-color: var(--una-fc-warning);
    animation-duration: 0.8s;
}

.una-fc-loader-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    fill: var(--una-fc-primary);
}

@keyframes unaFcSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Progress Text */
.una-fc-loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--una-fc-secondary);
    margin-bottom: 12px;
}

.una-fc-loading-status {
    font-size: 14px;
    color: var(--una-fc-gray-600);
    min-height: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.una-fc-loading-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: var(--una-fc-primary);
    border-radius: 50%;
    animation: unaFcBlink 1s infinite;
}

@keyframes unaFcBlink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* Progress Bar */
.una-fc-progress-bar {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: var(--una-fc-gray-200);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 20px;
}

.una-fc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--una-fc-primary), var(--una-fc-success));
    border-radius: 3px;
    width: 0%;
    transition: width 0.5s ease;
    animation: unaFcProgressPulse 1.5s infinite;
}

@keyframes unaFcProgressPulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* ==========================================================================
   Results Section
   ========================================================================== */
.una-fc-results {
    display: none;
}

.una-fc-results.visible {
    display: block;
    animation: unaFcFadeIn 0.5s ease;
}

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

/* Result Box */
.una-fc-result-box {
    background: var(--una-fc-white);
    border: 1px solid var(--una-fc-gray-200);
    border-radius: var(--una-fc-radius-md);
    margin-bottom: 16px;
    overflow: hidden;
}

.una-fc-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--una-fc-gray-100);
    border-bottom: 1px solid var(--una-fc-gray-200);
}

.una-fc-result-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--una-fc-secondary);
    margin: 0;
}

.una-fc-result-title svg {
    width: 18px;
    height: 18px;
    color: var(--una-fc-primary);
}

.una-fc-result-content {
    padding: 18px;
    font-size: 15px;
    line-height: 1.9;
    color: var(--una-fc-gray-800);
}

/* Case/Status Box - Full colored */
.una-fc-case-result-box {
    border: none;
    overflow: hidden;
}

.una-fc-case-result-box.true {
    background: var(--una-fc-success-light);
    border: 2px solid #c3e6cb;
}

.una-fc-case-result-box.true .una-fc-result-header {
    background: rgba(39, 174, 96, 0.15);
    border-bottom-color: #c3e6cb;
}

.una-fc-case-result-box.true .una-fc-result-title {
    color: #155724;
}

.una-fc-case-result-box.true .una-fc-result-title svg {
    color: #155724;
}

.una-fc-case-result-box.false {
    background: var(--una-fc-error-light);
    border: 2px solid #f5c6cb;
}

.una-fc-case-result-box.false .una-fc-result-header {
    background: rgba(231, 76, 60, 0.15);
    border-bottom-color: #f5c6cb;
}

.una-fc-case-result-box.false .una-fc-result-title {
    color: #721c24;
}

.una-fc-case-result-box.false .una-fc-result-title svg {
    color: #721c24;
}

.una-fc-case-box {
    text-align: center;
    padding: 24px;
}

.una-fc-case-badge {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    border-radius: var(--una-fc-radius-lg);
    font-size: 22px;
    font-weight: 700;
    background: transparent;
    border: none;
}

.una-fc-case-badge svg {
    width: 28px;
    height: 28px;
}

.una-fc-case-badge.true {
    color: #155724;
}

.una-fc-case-badge.false {
    color: #721c24;
}

/* Analysis Box */
.una-fc-analysis-content {
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Copy Button */
.una-fc-copy-btn {
    background: transparent;
    border: 1px solid var(--una-fc-gray-300);
    color: var(--una-fc-gray-600);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--una-fc-radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: var(--una-fc-transition);
    font-family: var(--una-fc-font-family);
}

.una-fc-copy-btn:hover {
    background: var(--una-fc-primary);
    border-color: var(--una-fc-primary);
    color: var(--una-fc-white);
}

.una-fc-copy-btn svg {
    width: 14px;
    height: 14px;
}

.una-fc-copy-btn.copied {
    background: var(--una-fc-success);
    border-color: var(--una-fc-success);
    color: var(--una-fc-white);
}

/* Sources Box */
.una-fc-sources-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.una-fc-source-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border-bottom: 1px solid var(--una-fc-gray-100);
    transition: var(--una-fc-transition);
}

.una-fc-source-item:last-child {
    border-bottom: none;
}

.una-fc-source-item:hover {
    background: var(--una-fc-gray-100);
}

.una-fc-source-icon {
    width: 32px;
    height: 32px;
    background: var(--una-fc-primary-light);
    border-radius: var(--una-fc-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.una-fc-source-icon svg {
    width: 16px;
    height: 16px;
    color: var(--una-fc-primary);
}

.una-fc-source-link {
    color: var(--una-fc-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: var(--una-fc-transition);
}

.una-fc-source-link:hover {
    color: var(--una-fc-primary-hover);
    text-decoration: underline;
}

/* New Check Button */
.una-fc-new-check {
    width: 100%;
    padding: 12px 24px;
    background: var(--una-fc-gray-100);
    border: 2px solid var(--una-fc-gray-300);
    border-radius: var(--una-fc-radius-md);
    color: var(--una-fc-gray-700);
    font-family: var(--una-fc-font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--una-fc-transition);
    margin-top: 20px;
}

.una-fc-new-check:hover {
    background: var(--una-fc-primary-light);
    border-color: var(--una-fc-primary);
    color: var(--una-fc-primary);
}

.una-fc-new-check svg {
    width: 18px;
    height: 18px;
}

/* ==========================================================================
   Direct URL Page Styles
   ========================================================================== */
.una-fc-page {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--una-fc-gray-100) 0%, var(--una-fc-primary-light) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    font-family: var(--una-fc-font-family);
    direction: rtl;
}

.una-fc-page-container {
    background: var(--una-fc-white);
    border-radius: var(--una-fc-radius-xl);
    box-shadow: var(--una-fc-shadow-xl);
    width: 100%;
    max-width: 700px;
    overflow: hidden;
}

/* ==========================================================================
   Error Message
   ========================================================================== */
.una-fc-error {
    display: none;
    padding: 16px;
    background: var(--una-fc-error-light);
    border: 1px solid #f5c6cb;
    border-radius: var(--una-fc-radius-md);
    color: #721c24;
    font-size: 14px;
    margin-bottom: 16px;
}

.una-fc-error.visible {
    display: flex;
    align-items: center;
    gap: 10px;
    animation: unaFcFadeIn 0.3s ease;
}

.una-fc-error svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
/* LTR Support - Floating Icon */
[dir="ltr"] #una-fc-trigger,
html:not([dir="rtl"]) body:not([dir="rtl"]) #una-fc-trigger {
    right: auto;
    left: 25px;
}

[dir="ltr"] #una-fc-trigger .una-fc-tooltip,
html:not([dir="rtl"]) body:not([dir="rtl"]) #una-fc-trigger .una-fc-tooltip {
    left: auto;
    right: 60px;
}

@media (max-width: 768px) {
    #una-fc-trigger {
        bottom: 90px;
        right: 15px;
        left: auto;
        width: 45px;
        height: 45px;
    }
    
    [dir="ltr"] #una-fc-trigger,
    html:not([dir="rtl"]) body:not([dir="rtl"]) #una-fc-trigger {
        right: auto;
        left: 15px;
    }
    
    #una-fc-trigger svg {
        width: 22px;
        height: 22px;
    }
    
    .una-fc-modal {
        max-height: 100vh;
        border-radius: var(--una-fc-radius-lg);
        margin: 10px;
    }
    
    .una-fc-header {
        padding: 16px 20px;
    }
    
    .una-fc-title {
        font-size: 18px;
    }
    
    .una-fc-body {
        padding: 20px;
    }
    
    .una-fc-info-box {
        padding: 14px 16px;
    }
    
    .una-fc-info-text {
        font-size: 13px;
    }
    
    .una-fc-textarea {
        min-height: 120px;
        font-size: 14px;
    }
    
    .una-fc-check-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .una-fc-result-content {
        padding: 14px;
        font-size: 13px;
    }
    
    .una-fc-case-badge {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .una-fc-source-item {
        padding: 10px;
    }
    
    .una-fc-source-link {
        font-size: 12px;
    }
    
    .una-fc-page {
        padding: 20px 15px;
    }
}

@media (max-width: 480px) {
    .una-fc-header-info {
        gap: 10px;
    }
    
    .una-fc-logo {
        width: 35px;
        height: 35px;
        padding: 6px;
    }
    
    .una-fc-title {
        font-size: 16px;
    }
    
    .una-fc-close {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* ==========================================================================
   RTL Support
   ========================================================================== */
[dir="rtl"] .una-fc-modal,
.una-fc-modal {
    text-align: right;
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .una-fc-overlay,
    #una-fc-trigger,
    .una-fc-shortcode-btn {
        display: none !important;
    }
}
