/* Logic Grade Widget Styles */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* Base Container */
.lg-dashboard {
    --lg-font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    
    font-family: var(--lg-font-family);
    background: var(--lg-container-bg, #f8fafc);
    border-radius: var(--lg-container-radius, 16px);
    padding: 32px;
    max-width: 720px;
    margin: 0 auto;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Header */
.lg-header {
    text-align: center;
    margin-bottom: 24px;
}

.lg-title {
    font-family: var(--lg-font-family);
    font-size: 24px;
    font-weight: 700;
    color: var(--lg-title-color, #1e293b);
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.lg-subtitle {
    font-family: var(--lg-font-family);
    font-size: 14px;
    font-weight: 400;
    color: var(--lg-subtitle-color, #64748b);
    margin: 0;
    line-height: 1.5;
}

/* Search Section */
.lg-search-section {
    margin-bottom: 32px;
}

.lg-search-wrapper {
    display: flex;
    gap: 12px;
    background: #ffffff;
    padding: 6px;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lg-search-wrapper:focus-within {
    border-color: var(--lg-button-bg, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.lg-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 16px;
    font-family: var(--lg-font-family);
    font-size: 14px;
    color: #1e293b;
    background: transparent;
    min-width: 0;
}

.lg-search-input::placeholder {
    color: #94a3b8;
}

.lg-search-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--lg-button-bg, #2563eb);
    color: var(--lg-button-text, #ffffff);
    border: none;
    border-radius: var(--lg-button-radius, 8px);
    font-family: var(--lg-font-family);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.lg-search-button:hover {
    background: var(--lg-button-hover-bg, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
    color: var(--lg-button-text, #ffffff);
    text-decoration: none;
}

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

.lg-search-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Results Section */
.lg-results-section {
    display: flex;
    gap: 32px;
    align-items: flex-start;
}

/* Score Ring */
.lg-score-container {
    flex-shrink: 0;
}

.lg-score-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

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

.lg-ring-bg {
    fill: none;
    stroke: var(--lg-ring-bg, #e2e8f0);
    stroke-width: 10;
}

.lg-ring-progress {
    fill: none;
    stroke-width: 10;
    stroke-linecap: round;
    transition: stroke 0.3s ease;
}

.lg-score-ring.score-low .lg-ring-progress {
    stroke: var(--lg-score-low, #ef4444);
}

.lg-score-ring.score-mid .lg-ring-progress {
    stroke: var(--lg-score-mid, #f59e0b);
}

.lg-score-ring.score-high .lg-ring-progress {
    stroke: var(--lg-score-high, #22c55e);
}

.lg-score-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    line-height: 1;
}

.lg-score-value {
    display: block;
    font-size: 36px;
    font-weight: 700;
    color: var(--lg-score-text, #1e293b);
}

.lg-score-ring.score-low .lg-score-value {
    color: var(--lg-score-low, #ef4444);
}

.lg-score-ring.score-mid .lg-score-value {
    color: var(--lg-score-mid, #f59e0b);
}

.lg-score-ring.score-high .lg-score-value {
    color: var(--lg-score-high, #22c55e);
}

.lg-score-max {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #94a3b8;
    margin-top: 4px;
}

/* Issues Table */
.lg-issues-table {
    flex: 1;
    min-width: 0;
}

.lg-table-header {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 16px;
    padding: 0 0 12px 0;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 8px;
}

.lg-table-header span {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.lg-table-row {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
    align-items: center;
    transition: background 0.2s ease, transform 0.2s ease;
}

.lg-table-row:last-child {
    border-bottom: none;
}

.lg-table-row:hover {
    background: rgba(255, 255, 255, 0.7);
    transform: translateX(4px);
}

.lg-col-issue {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
}

.lg-col-impact {
    font-size: 13px;
    color: #64748b;
}

.lg-impact-value {
    font-weight: 600;
    color: #1e293b;
    margin-right: 4px;
}

.lg-impact-label {
    font-weight: 400;
}

.lg-col-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--status-color, #64748b);
}

.lg-status-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    opacity: 0.9;
}

.lg-status-text {
    font-weight: 500;
}

/* ============================================
   ANIMATIONS
   ============================================ */

/* Initial states for animated elements */
.lg-animated .lg-ring-progress {
    stroke-dashoffset: 326.73 !important;
}

.lg-animated .lg-score-value {
    opacity: 0;
}

.lg-animated .lg-table-row {
    opacity: 0;
    transform: translateY(20px);
}

.lg-animated .lg-header {
    opacity: 0;
    transform: translateY(-10px);
}

.lg-animated .lg-search-wrapper {
    opacity: 0;
    transform: scale(0.98);
}

/* Animation states when in view */
.lg-animated.lg-in-view .lg-header {
    animation: lgFadeInDown 0.6s ease forwards;
}

.lg-animated.lg-in-view .lg-search-wrapper {
    animation: lgFadeInScale 0.5s ease 0.2s forwards;
}

.lg-animated.lg-in-view .lg-ring-progress {
    animation: lgRingFill var(--lg-animation-duration, 1500ms) cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
}

.lg-animated.lg-in-view .lg-score-value {
    animation: lgFadeIn 0.3s ease 0.8s forwards;
}

.lg-animated.lg-in-view .lg-table-row {
    animation: lgSlideInUp 0.5s ease forwards;
    animation-delay: calc(0.6s + (var(--row-index, 0) * var(--lg-stagger-delay, 150ms)));
}

/* Keyframes */
@keyframes lgFadeInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes lgFadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes lgFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes lgRingFill {
    to {
        stroke-dashoffset: var(--target-offset, 0);
    }
}

/* Status Icon Pulse Animation */
.lg-animated.lg-in-view .lg-status-icon {
    animation: lgPulse 2s ease-in-out infinite;
    animation-delay: calc(1.5s + (var(--row-index, 0) * 0.2s));
}

@keyframes lgPulse {
    0%, 100% {
        opacity: 0.9;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Score counting animation class */
.lg-counting {
    animation: lgCountPulse 0.1s ease;
}

@keyframes lgCountPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
    }
}

/* Loading State */
.lg-search-button.lg-loading {
    pointer-events: none;
    position: relative;
}

.lg-search-button.lg-loading span {
    opacity: 0;
}

.lg-search-button.lg-loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: lgSpin 0.8s linear infinite;
}

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

/* Hover effects for score ring */
.lg-score-ring {
    transition: transform 0.3s ease;
}

.lg-score-ring:hover {
    transform: scale(1.05);
}

/* Responsive */
@media (max-width: 640px) {
    .lg-dashboard {
        padding: 24px 16px;
    }
    
    .lg-results-section {
        flex-direction: column;
        align-items: center;
        gap: 24px;
    }
    
    .lg-score-container {
        order: -1;
    }
    
    .lg-issues-table {
        width: 100%;
    }
    
    .lg-table-header,
    .lg-table-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .lg-table-header {
        display: none;
    }
    
    .lg-table-row {
        background: #ffffff;
        padding: 16px;
        border-radius: 8px;
        border: 1px solid #e2e8f0;
        margin-bottom: 8px;
    }
    
    .lg-col-issue {
        font-size: 14px;
    }
    
    .lg-col-impact::before {
        content: 'Impact: ';
        color: #94a3b8;
        font-weight: 400;
    }
    
    .lg-col-status::before {
        content: 'Status: ';
        color: #94a3b8;
        font-weight: 400;
        margin-right: 4px;
    }
    
    .lg-search-wrapper {
        flex-direction: column;
    }
    
    .lg-search-button {
        justify-content: center;
    }
}

/* Elementor Editor Styles */
.elementor-editor-active .lg-animated .lg-ring-progress,
.elementor-editor-active .lg-animated .lg-score-value,
.elementor-editor-active .lg-animated .lg-table-row,
.elementor-editor-active .lg-animated .lg-header,
.elementor-editor-active .lg-animated .lg-search-wrapper {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
}

.elementor-editor-active .lg-animated .lg-ring-progress {
    stroke-dashoffset: var(--target-offset) !important;
}
