/**
 * Test Widget Styles
 * 
 * Styling for the interactive test widget on homepage
 * Brand colors: Ion Violet (#6B5BFF) + Laser Coral (#FF3D5A)
 */

/* ========== Container ========== */
.test-widget-container {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    margin: 60px auto 40px;
    max-width: 700px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* ========== States ========== */
.widget-state {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ========== State 1: Initial ========== */
.widget-header {
    margin-bottom: 24px;
}

.widget-title {
    font-size: 24px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 12px;
    line-height: 1.3;
}

.widget-subtitle {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0;
    line-height: 1.5;
}

.widget-domain-input {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.domain-input {
    flex: 1;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.domain-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: #6B5BFF;
    box-shadow: 0 0 0 3px rgba(107, 91, 255, 0.2);
}

.domain-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.btn-test-domain {
    padding: 16px 32px;
    background: #FF3D5A;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-test-domain:hover {
    background: #E73551;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 61, 90, 0.4);
}

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

.btn-test-domain:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.widget-microcopy {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    margin-bottom: 12px;
}

/* ========== Validation Messages ========== */
.widget-validation-message {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    margin-top: 12px;
    display: none;
}

.widget-validation-message.error {
    background: rgba(255, 61, 90, 0.15);
    border: 1px solid rgba(255, 61, 90, 0.3);
    color: #FF3D5A;
}

.widget-validation-message.success {
    background: rgba(107, 255, 91, 0.15);
    border: 1px solid rgba(107, 255, 91, 0.3);
    color: #6BFF5B;
}

/* ========== State 2: Search ========== */
.widget-domain-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(107, 91, 255, 0.12);
    border: 1px solid rgba(107, 91, 255, 0.3);
    border-radius: 20px;
    padding: 8px 16px;
    margin-bottom: 24px;
    font-size: 15px;
    color: #ffffff;
}

.chip-check {
    color: #6BFF5B;
    font-weight: 700;
    font-size: 16px;
}

.chip-domain {
    color: #ffffff;
    font-weight: 600;
}

.chip-remove {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #ffffff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s ease;
    padding: 0;
    margin-left: 4px;
}

.chip-remove:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    transform: scale(1.1);
}

.widget-search-bar {
    margin-bottom: 20px;
}

.search-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 12px;
}

.search-input-group {
    display: flex;
    gap: 12px;
}

.search-query-input {
    flex: 1;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-query-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: #6B5BFF;
    box-shadow: 0 0 0 3px rgba(107, 91, 255, 0.2);
}

.search-query-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.btn-search {
    padding: 16px 32px;
    background: #FF3D5A;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-search:hover {
    background: #E73551;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 61, 90, 0.4);
}

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

.btn-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========== Counter ========== */
.widget-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.counter-text {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
}

.counter-dots {
    display: flex;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.dot-filled {
    background: #6B5BFF;
    box-shadow: 0 0 8px rgba(107, 91, 255, 0.6);
}

.dot-empty {
    background: rgba(255, 255, 255, 0.2);
}

.counter-value {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ========== State 4: Quota Exhausted ========== */
.widget-email-input {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    justify-content: center;
}

.email-input {
    flex: 1;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: #ffffff;
    font-size: 16px;
    transition: all 0.3s ease;
}

.email-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: #6B5BFF;
    box-shadow: 0 0 0 3px rgba(107, 91, 255, 0.2);
}

.email-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.btn-continue {
    display: inline-block;
    padding: 16px 32px;
    background: #FF3D5A;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
}

.btn-continue:hover {
    background: #E73551;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(255, 61, 90, 0.4);
    text-decoration: none;
}

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

.btn-continue:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ========== State 5: Loading ========== */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #6B5BFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Spinner for search loading (image-based) */
.search-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.search-spinner img {
    width: 24px;
    height: 24px;
    display: block;
    animation: spin 1s linear infinite;
}

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

/* ========== Results ========== */
.widget-results {
    margin-top: 32px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 8px;
}

.widget-results::-webkit-scrollbar {
    width: 6px;
}

.widget-results::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.widget-results::-webkit-scrollbar-thumb {
    background: rgba(107, 91, 255, 0.5);
    border-radius: 3px;
}

.widget-results::-webkit-scrollbar-thumb:hover {
    background: rgba(107, 91, 255, 0.7);
}

.search-result-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 16px;
    animation: fadeInUp 0.4s ease;
    text-align: left;
}

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

.result-query {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 16px;
    line-height: 1.6;
}

.result-query strong {
    color: #6B5BFF;
}

.result-answer {
    font-size: 17px;
    line-height: 1.7;
    color: #ffffff;
}

.answer-content {
    color: #ffffff;
    font-size: 17px;
}

.answer-content p {
    margin-bottom: 12px;
    color: #ffffff;
}

.answer-content ul,
.answer-content ol {
    margin: 12px 0;
    padding-left: 24px;
    color: #ffffff;
}

.answer-content li {
    margin-bottom: 8px;
    color: #ffffff;
}

.answer-content strong,
.answer-content h1,
.answer-content h2,
.answer-content h3,
.answer-content h4,
.answer-content h5,
.answer-content h6 {
    color: #ffffff;
    font-weight: 600;
    margin-top: 16px;
    margin-bottom: 8px;
}

.answer-content a {
    color: #6B5BFF;
    text-decoration: underline;
}

.answer-content a:hover {
    color: #8B7BFF;
}

.answer-content code {
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
}

/* Source (single) */
.result-source {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.source-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(107, 91, 255, 0.1);
}

.source-link:hover {
    background: rgba(107, 91, 255, 0.2);
    transform: translateX(4px);
    color: #ffffff;
}

.source-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B5BFF;
    font-size: 20px;
    transition: all 0.3s ease;
}

.source-link:hover .source-icon {
    color: #8B7FFF;
    transform: translateX(2px);
}

.source-text {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    .test-widget-container {
        padding: 24px;
        border-radius: 16px;
    }
    
    .widget-domain-input,
    .search-input-group,
    .widget-email-input {
        flex-direction: column;
    }
    
    .btn-test-domain,
    .btn-search,
    .btn-continue {
        width: 100%;
    }
    
    .widget-counter {
        flex-direction: column;
        gap: 8px;
    }
    
    .domain-input,
    .search-query-input,
    .email-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

