/**
 * NSEMM Quick Help - Styles
 * Version: 26.1.1
 */

/* CSS Variables */
:root {
    --qh-primary: #1C3B70;
    --qh-secondary: #FACD00;
    --qh-accent: #00FACD;
    --qh-text: #2B2A2A;
    --qh-text-light: #666;
    --qh-bg: #ffffff;
    --qh-bg-light: #f8f9fa;
    --qh-border: #AEBCD4;
    --qh-success: #8BD6AC;
    --qh-error: #FA00CD;
    --qh-shadow: rgba(28, 59, 112, 0.15);
}

/* Floating Widget */
.nsemm-quick-help-widget {
    position: fixed;
    z-index: 9999;
    font-family: 'Readex Pro', -apple-system, BlinkMacSystemFont, sans-serif;
}

.nsemm-quick-help-widget.bottom-left {
    bottom: 20px;
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
    left: 20px;
}

.nsemm-quick-help-widget.bottom-right {
    bottom: 20px;
    bottom: max(20px, calc(env(safe-area-inset-bottom) + 20px));
    right: 20px;
}

/* Toggle Button */
.quick-help-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--qh-primary);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 15px var(--qh-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.quick-help-toggle:hover {
    background: #2d5aa0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--qh-shadow);
}

.quick-help-toggle:focus {
    outline: 3px solid var(--qh-secondary);
    outline-offset: 2px;
}

.quick-help-toggle[aria-expanded="true"] {
    background: var(--qh-error);
}

.quick-help-icon {
    width: 20px;
    height: 20px;
}

/* Panel */
.quick-help-panel {
    position: absolute;
    bottom: 60px;
    width: 350px;
    max-height: 500px;
    background: var(--qh-bg);
    border-radius: 16px;
    box-shadow: 0 10px 40px var(--qh-shadow);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 2px solid var(--qh-border);
}

.bottom-left .quick-help-panel {
    left: 0;
}

.bottom-right .quick-help-panel {
    right: 0;
}

.quick-help-panel.open {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

/* Panel Header */
.quick-help-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--qh-primary);
    color: white;
}

.quick-help-panel-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Sora', sans-serif;
}

.quick-help-close {
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.quick-help-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.quick-help-close svg {
    width: 20px;
    height: 20px;
}

/* Panel Body */
.quick-help-panel-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

/* Sections */
.quick-help-section {
    margin-bottom: 20px;
}

.quick-help-section:last-child {
    margin-bottom: 0;
}

.quick-help-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--qh-primary);
}

/* Search Form */
.quick-help-search-form {
    display: flex;
    gap: 8px;
}

.quick-help-input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid var(--qh-border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--qh-text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.quick-help-input:focus {
    outline: none;
    border-color: var(--qh-primary);
    box-shadow: 0 0 0 3px rgba(28, 59, 112, 0.1);
}

.quick-help-submit {
    padding: 10px 14px;
    background: var(--qh-secondary);
    color: var(--qh-text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.quick-help-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(250, 205, 0, 0.3);
}

.quick-help-submit svg {
    width: 18px;
    height: 18px;
}

/* Search Results */
.quick-help-results {
    margin-top: 12px;
}

.quick-help-result-item {
    padding: 12px;
    background: var(--qh-bg-light);
    border-radius: 8px;
    margin-bottom: 8px;
    border: 1px solid var(--qh-border);
    transition: background-color 0.2s ease;
}

.quick-help-result-item:hover {
    background: #e9ecef;
}

.quick-help-result-item a {
    color: var(--qh-primary);
    text-decoration: none;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.quick-help-result-item p {
    margin: 0;
    font-size: 13px;
    color: var(--qh-text-light);
    line-height: 1.4;
}

/* Safeguarding Alert */
.quick-help-safeguarding {
    padding: 16px;
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    margin-top: 12px;
}

.quick-help-safeguarding p {
    margin: 0 0 12px 0;
    font-weight: 600;
    color: #856404;
}

.quick-help-safeguarding-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quick-help-safeguarding-actions a {
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: transform 0.2s ease;
}

.quick-help-safeguarding-actions a:hover {
    transform: translateY(-1px);
}

.quick-help-safeguarding-actions a.emergency {
    background: #dc3545;
    color: white;
}

.quick-help-safeguarding-actions a.helpline {
    background: #28a745;
    color: white;
}

.quick-help-safeguarding-actions a.info {
    background: var(--qh-primary);
    color: white;
}

/* Contact Section */
.quick-help-contact-section {
    text-align: center;
    padding: 16px;
    background: var(--qh-bg-light);
    border-radius: 12px;
    border: 1px solid var(--qh-border);
}

.quick-help-contact-desc {
    margin: 0 0 16px 0;
    font-size: 13px;
    color: var(--qh-text-light);
    line-height: 1.5;
}

.quick-help-contact-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--qh-primary);
    color: white !important;
    text-decoration: none !important;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.quick-help-contact-btn:hover {
    background: #2d5aa0;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--qh-shadow);
    color: white !important;
}

.quick-help-contact-btn:focus {
    outline: 3px solid var(--qh-secondary);
    outline-offset: 2px;
}

.quick-help-contact-btn svg {
    flex-shrink: 0;
}

/* Panel Footer */
.quick-help-panel-footer {
    padding: 12px 20px;
    background: var(--qh-bg-light);
    border-top: 1px solid var(--qh-border);
}

.quick-help-portal-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--qh-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: color 0.2s ease;
}

.quick-help-portal-link:hover {
    color: var(--qh-error);
}

.quick-help-portal-link svg {
    width: 16px;
    height: 16px;
}

/* Embedded Widget (Shortcode) */
.nsemm-quick-help-embedded {
    background: var(--qh-bg);
    border: 2px solid var(--qh-border);
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
    box-shadow: 0 4px 15px var(--qh-shadow);
}

.nsemm-quick-help-embedded .quick-help-header {
    margin-bottom: 20px;
}

.nsemm-quick-help-embedded .quick-help-title {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--qh-primary);
    font-family: 'Sora', sans-serif;
}

.nsemm-quick-help-embedded .quick-help-subtitle {
    margin: 0;
    color: var(--qh-text-light);
}

.nsemm-quick-help-embedded .quick-help-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--qh-border);
    text-align: center;
}

.nsemm-quick-help-embedded .quick-help-footer a {
    color: var(--qh-primary);
    font-weight: 600;
}

/* Support Section (Shortcode) */
.nsemm-support-section {
    background: var(--qh-bg-light);
    border: 2px solid var(--qh-border);
    border-radius: 16px;
    padding: 32px;
    margin: 24px 0;
    text-align: center;
}

.nsemm-support-section h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    color: var(--qh-primary);
    font-family: 'Sora', sans-serif;
}

.nsemm-support-section p {
    margin: 0 0 20px 0;
    color: var(--qh-text-light);
    line-height: 1.6;
}

.nsemm-support-btn {
    display: inline-block;
    padding: 14px 28px;
    background: var(--qh-primary);
    color: white !important;
    text-decoration: none !important;
    border-radius: 25px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nsemm-support-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--qh-shadow);
    color: white !important;
}

/* Loading State */
.quick-help-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.quick-help-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--qh-border);
    border-top-color: var(--qh-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 480px) {
    .quick-help-panel {
        width: calc(100vw - 40px);
        max-width: 350px;
    }

    .quick-help-toggle .quick-help-text {
        display: none;
    }

    .quick-help-toggle {
        padding: 14px;
        border-radius: 50%;
    }

    .nsemm-quick-help-embedded,
    .nsemm-support-section {
        padding: 20px;
        margin: 16px 0;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .quick-help-toggle,
    .quick-help-submit,
    .quick-help-submit-btn,
    .quick-help-panel,
    .quick-help-spinner {
        transition: none;
        animation: none;
    }
}

/* High Contrast */
@media (prefers-contrast: high) {
    .quick-help-panel,
    .nsemm-quick-help-embedded,
    .nsemm-support-section {
        border-width: 3px;
    }

    .quick-help-input,
    .quick-help-textarea {
        border-width: 3px;
    }
}
