/**
 * HealthSpark Admin Styles
 * Premium, modern dashboard design
 */

/* ============================================
   Reset & Base
   ============================================ */
.healthspark-wrap {
    max-width: 1200px;
    margin: 20px auto 40px;
    padding: 0 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
}

.healthspark-wrap *,
.healthspark-wrap *::before,
.healthspark-wrap *::after {
    box-sizing: border-box;
}

/* ============================================
   Header
   ============================================ */
.healthspark-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 28px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.healthspark-header__left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.healthspark-header__right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.healthspark-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1e293b;
}

.healthspark-logo h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    padding: 0;
    letter-spacing: -0.5px;
}

.healthspark-version {
    background: #f1f5f9;
    color: #64748b;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.healthspark-last-scan {
    color: #94a3b8;
    font-size: 13px;
}

/* ============================================
   Buttons
   ============================================ */
.healthspark-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #475569;
    transition: all 0.2s ease;
    line-height: 1.4;
}

.healthspark-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
    color: #334155;
}

.healthspark-btn--primary {
    background: #6366f1;
    border-color: #6366f1;
    color: #fff;
    box-shadow: 0 1px 3px rgba(99, 102, 241, 0.3);
}

.healthspark-btn--primary:hover {
    background: #4f46e5;
    border-color: #4f46e5;
    color: #fff;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.healthspark-btn--pro {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.healthspark-btn--pro:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
    color: #fff;
}

.healthspark-btn--large {
    padding: 12px 28px;
    font-size: 15px;
    border-radius: 10px;
}

.healthspark-btn:disabled,
.healthspark-btn.is-scanning {
    opacity: 0.7;
    pointer-events: none;
}

/* ============================================
   Welcome State
   ============================================ */
.healthspark-welcome {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    padding: 60px 40px;
    text-align: center;
}

.healthspark-welcome__inner {
    max-width: 560px;
    margin: 0 auto;
}

.healthspark-welcome__inner h2 {
    font-size: 26px;
    font-weight: 700;
    color: #1e293b;
    margin: 20px 0 10px;
    letter-spacing: -0.5px;
}

.healthspark-welcome__inner p {
    color: #64748b;
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 32px;
}

.healthspark-welcome__modules {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 36px;
    flex-wrap: wrap;
}

.healthspark-welcome__module {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

.healthspark-welcome__module-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* ============================================
   Scanning Animation
   ============================================ */
.healthspark-scanning {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.healthspark-scanning__inner {
    text-align: center;
    position: relative;
}

.healthspark-scanning__pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -80%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.1);
    animation: healthspark-pulse 2s ease-in-out infinite;
}

@keyframes healthspark-pulse {
    0%, 100% { transform: translate(-50%, -80%) scale(1); opacity: 1; }
    50% { transform: translate(-50%, -80%) scale(1.5); opacity: 0; }
}

.healthspark-scanning h2 {
    font-size: 20px;
    color: #1e293b;
    margin: 20px 0 8px;
}

.healthspark-scanning p {
    color: #64748b;
    font-size: 14px;
    margin: 0 0 24px;
}

.healthspark-scanning__bar {
    width: 280px;
    height: 4px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin: 0 auto;
}

.healthspark-scanning__bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 4px;
    width: 0;
    animation: healthspark-progress 4s ease-in-out forwards;
}

@keyframes healthspark-progress {
    0% { width: 0; }
    30% { width: 40%; }
    60% { width: 70%; }
    90% { width: 85%; }
    100% { width: 95%; }
}

/* ============================================
   Score Overview
   ============================================ */
.healthspark-overview {
    display: flex;
    align-items: center;
    gap: 40px;
    background: #fff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    padding: 32px 40px;
    margin-bottom: 24px;
}

.healthspark-score-ring {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.healthspark-score-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.healthspark-score-ring__bg {
    fill: none;
    stroke: #f1f5f9;
    stroke-width: 8;
}

.healthspark-score-ring__fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease, stroke 0.3s;
}

.healthspark-score--good .healthspark-score-ring__fill { stroke: #10b981; }
.healthspark-score--warning .healthspark-score-ring__fill { stroke: #f59e0b; }
.healthspark-score--critical .healthspark-score-ring__fill { stroke: #ef4444; }

.healthspark-score-ring__value {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.healthspark-score-ring__number {
    font-size: 40px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
    letter-spacing: -2px;
}

.healthspark-score-ring__label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
    max-width: 90px;
    text-align: center;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.healthspark-score--good .healthspark-score-ring__label { color: #10b981; }
.healthspark-score--warning .healthspark-score-ring__label { color: #f59e0b; }
.healthspark-score--critical .healthspark-score-ring__label { color: #ef4444; }

.healthspark-stats {
    display: flex;
    gap: 40px;
}

.healthspark-stat {
    display: flex;
    flex-direction: column;
}

.healthspark-stat__number {
    font-size: 32px;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
}

.healthspark-stat--critical .healthspark-stat__number {
    color: #ef4444;
}

.healthspark-stat__label {
    font-size: 13px;
    color: #94a3b8;
    margin-top: 4px;
    font-weight: 500;
}

/* ============================================
   Module Cards
   ============================================ */
.healthspark-modules {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.healthspark-module-card {
    background: #fff;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    padding: 24px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.healthspark-module-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    transform: translateY(-1px);
}

.healthspark-module-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.healthspark-module-card__title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.healthspark-module-card__icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}

.healthspark-module-card__title h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.healthspark-module-card__score {
    font-size: 20px;
    font-weight: 800;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    letter-spacing: -0.5px;
}

.healthspark-score--good.healthspark-module-card__score { background: #ecfdf5; color: #10b981; }
.healthspark-score--warning.healthspark-module-card__score { background: #fffbeb; color: #f59e0b; }
.healthspark-score--critical.healthspark-module-card__score { background: #fef2f2; color: #ef4444; }

.healthspark-module-card__summary {
    color: #94a3b8;
    font-size: 13px;
    margin: 0 0 14px;
}

/* Progress bar */
.healthspark-module-card__progress {
    height: 4px;
    background: #f1f5f9;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.healthspark-module-card__progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 1s ease;
}

/* Issues */
.healthspark-module-card__issues {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.healthspark-issue {
    padding: 12px 14px;
    border-radius: 10px;
    border-left: 3px solid;
}

.healthspark-issue--critical {
    background: #fef2f2;
    border-left-color: #ef4444;
}

.healthspark-issue--warning {
    background: #fffbeb;
    border-left-color: #f59e0b;
}

.healthspark-issue--info {
    background: #f0f9ff;
    border-left-color: #3b82f6;
}

.healthspark-issue__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.healthspark-issue__severity {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 6px;
    border-radius: 4px;
}

.healthspark-issue--critical .healthspark-issue__severity { background: #fee2e2; color: #dc2626; }
.healthspark-issue--warning .healthspark-issue__severity { background: #fef3c7; color: #d97706; }
.healthspark-issue--info .healthspark-issue__severity { background: #dbeafe; color: #2563eb; }

.healthspark-issue__title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.healthspark-issue__desc {
    font-size: 12px;
    color: #64748b;
    margin: 2px 0 0;
    line-height: 1.5;
}

.healthspark-issue__fix {
    display: inline-block;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
    text-decoration: none;
}

.healthspark-issue__fix:hover {
    color: #4f46e5;
    text-decoration: underline;
}

/* Fix buttons */
.healthspark-issue__actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.healthspark-fix-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #6366f1;
    background: #eef2ff;
    color: #4f46e5;
    transition: all 0.2s ease;
}

.healthspark-fix-btn:hover {
    background: #6366f1;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.healthspark-fix-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.healthspark-fix-btn--done {
    background: #ecfdf5;
    border-color: #10b981;
    color: #059669;
    cursor: default;
    pointer-events: none;
}

.healthspark-fix-result {
    margin-top: 8px;
}

.healthspark-fix-success {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 12px;
    background: #f0fdf4;
    border-radius: 6px;
    font-size: 12px;
    color: #166534;
    line-height: 1.5;
}

.healthspark-fix-error {
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 6px;
    font-size: 12px;
    color: #991b1b;
    line-height: 1.5;
}

/* Spinning animation */
@keyframes healthspark-spin {
    to { transform: rotate(360deg); }
}

.healthspark-spin {
    animation: healthspark-spin 0.8s linear infinite;
}

/* Passed checks */
.healthspark-module-card__passed {
    margin-top: 4px;
}

.healthspark-toggle-passed {
    background: none;
    border: none;
    color: #10b981;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.healthspark-toggle-passed:hover {
    color: #059669;
}

.healthspark-toggle-arrow {
    transition: transform 0.2s;
}

.healthspark-toggle-passed.is-open .healthspark-toggle-arrow {
    transform: rotate(180deg);
}

.healthspark-passed-list {
    padding: 8px 0 0;
}

.healthspark-passed-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #64748b;
    padding: 3px 0;
}

/* ============================================
   Pro Upsell Banner
   ============================================ */
.healthspark-pro-banner {
    background: linear-gradient(135deg, #312e81 0%, #4338ca 40%, #6366f1 100%);
    border-radius: 16px;
    padding: 40px;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.healthspark-pro-banner,
.healthspark-pro-banner *,
.healthspark-pro-banner h3,
.healthspark-pro-banner p,
.healthspark-pro-banner li,
.healthspark-pro-banner ul {
    color: #fff !important;
}

.healthspark-pro-banner li {
    color: rgba(255,255,255,0.92) !important;
}

.healthspark-pro-banner::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
}

.healthspark-pro-banner::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}

.healthspark-pro-banner__content {
    position: relative;
    z-index: 1;
}

.healthspark-pro-banner h3 {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 16px;
    letter-spacing: -0.3px;
}

.healthspark-pro-banner ul {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 24px;
}

.healthspark-pro-banner li {
    font-size: 14px;
    padding-left: 22px;
    position: relative;
}

.healthspark-pro-banner li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: #a5f3fc !important;
    font-weight: 700;
}

.healthspark-pro-banner .healthspark-btn--pro {
    background: #fff;
    color: #4338ca !important;
    border: none;
    font-size: 15px;
}

.healthspark-pro-banner .healthspark-btn--pro:hover {
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ============================================
   Settings
   ============================================ */
.healthspark-settings-form {
    max-width: 680px;
}

.healthspark-settings-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 28px;
    margin-bottom: 20px;
}

.healthspark-settings-section h2 {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.healthspark-settings-desc {
    color: #94a3b8;
    font-size: 13px;
    margin: 0 0 20px;
}

.healthspark-pro-badge {
    display: inline-flex;
    padding: 2px 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.healthspark-settings-modules {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.healthspark-settings-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    padding: 12px 16px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    transition: background 0.2s;
}

.healthspark-settings-toggle:hover {
    background: #f1f5f9;
}

.healthspark-settings-toggle input[type="checkbox"] {
    display: none;
}

.healthspark-settings-toggle__slider {
    width: 40px;
    height: 22px;
    background: #cbd5e1;
    border-radius: 11px;
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}

.healthspark-settings-toggle__slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.healthspark-settings-toggle input:checked + .healthspark-settings-toggle__slider {
    background: #6366f1;
}

.healthspark-settings-toggle input:checked + .healthspark-settings-toggle__slider::after {
    transform: translateX(18px);
}

.healthspark-settings-toggle__icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.healthspark-settings-toggle__label {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

.healthspark-settings-field {
    margin-top: 12px;
}

.healthspark-settings-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    margin-bottom: 4px;
}

.healthspark-settings-field input[type="email"] {
    width: 100%;
    max-width: 360px;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
}

.healthspark-settings-actions {
    padding-top: 8px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 782px) {
    .healthspark-overview {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 24px;
        gap: 24px;
    }

    .healthspark-stats {
        gap: 24px;
    }

    .healthspark-modules {
        grid-template-columns: 1fr;
    }

    .healthspark-pro-banner ul {
        grid-template-columns: 1fr;
    }

    .healthspark-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
