/**
 * GPTDetector Plugin Theme Integration
 * Styles to make the detector shortcode work with light/dark themes
 */

/* Base detector wrapper inherits theme */
.gptdetector-wrapper,
#gptdetector-wrapper {
    background: transparent;
    color: var(--text-primary);
}

/* Ensure all child elements inherit text color */
.gptdetector-wrapper *,
#gptdetector-wrapper * {
    color: inherit;
}

/* Input Section */
.gptdetector-input-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

/* Textarea */
.gptdetector-textarea-wrapper {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.gptdetector-textarea-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.1);
}

.gptdetector-input {
    background: transparent;
    color: var(--text-primary);
    border: none;
    font-size: 1rem;
    line-height: 1.6;
}

.gptdetector-input::placeholder {
    color: var(--text-muted);
}

/* Word Counter */
.gptdetector-word-counter {
    color: var(--text-muted);
    background: var(--bg-hover);
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Buttons */
.gptdetector-btn {
    background: var(--primary);
    color: #FFFFFF;
    border: 2px solid var(--primary);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.gptdetector-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}


.gptdetector-btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.gptdetector-btn-ghost:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.gptdetector-btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.gptdetector-btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.gptdetector-btn-outline:hover {
    background: var(--primary);
    color: #FFFFFF;
}

/* Controls */
.gptdetector-controls {
    margin-top: 1rem;
}

/* Divider */
.gptdetector-divider {
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
    position: relative;
}

.gptdetector-divider span {
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 0 1rem;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Source Options */
.gptdetector-source-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.gptdetector-url-input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    flex: 1;
}

.gptdetector-url-input::placeholder {
    color: var(--text-muted);
}

.gptdetector-file-input {
    display: none;
}

/* Limits Info */
.gptdetector-limits-info {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.gptdetector-limits-info .limits-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
}

.gptdetector-limits-info .limits-reset {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.gptdetector-limits-info .reset-icon {
    color: var(--primary);
}

/* Results Section */
.gptdetector-results {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 2rem;
    box-shadow: var(--shadow-sm);
}

/* Result Cards */
.gptdetector-result-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.gptdetector-score {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
}

.gptdetector-score-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Progress Bars */
.gptdetector-progress {
    background: var(--bg-hover);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.gptdetector-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--secondary) 100%);
    transition: width 0.5s ease;
}

/* Loading State */
.gptdetector-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.gptdetector-spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error State */
.gptdetector-error {
    background: rgba(var(--danger-rgb), 0.1);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 1rem;
    border-radius: 8px;
    margin: 1rem 0;
}

/* Light Theme Specific */
[data-theme="light"] .gptdetector-wrapper {
    --primary-rgb: 0, 119, 204;
    --danger-rgb: 220, 53, 69;
}

[data-theme="light"] .gptdetector-input-section {
    background: #FFFFFF;
    border-color: #C8C4BE;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .gptdetector-textarea-wrapper {
    background: #FFFFFF;
    border-color: #D0CCC6;
}

[data-theme="light"] .gptdetector-textarea-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 119, 204, 0.1);
}

[data-theme="light"] .gptdetector-word-counter {
    background: #F8F6F3;
    border-color: #E5E2DD;
}

[data-theme="light"] .gptdetector-results {
    background: #FFFFFF;
    border-color: #C8C4BE;
}

[data-theme="light"] .gptdetector-result-card {
    background: #FAF9F7;
    border-color: #D0CCC6;
}

[data-theme="light"] .gptdetector-limits-info {
    background: #F8F6F3;
    border-color: #D0CCC6;
}

[data-theme="light"] .gptdetector-limits-info .limits-role {
    background: rgba(0, 119, 204, 0.08);
    color: #3D3D3D;
}

[data-theme="light"] .gptdetector-limits-info .limits-reset {
    background: rgba(0, 119, 204, 0.05);
    border-color: rgba(0, 119, 204, 0.15);
    color: #3D3D3D;
}

[data-theme="light"] .gptdetector-limits-info .reset-icon {
    color: #0077CC;
}

/* Dark Theme Specific */
[data-theme="dark"] .gptdetector-wrapper {
    --primary-rgb: 0, 217, 255;
    --danger-rgb: 255, 56, 56;
}

[data-theme="dark"] .gptdetector-input-section {
    background: #1A2332;
    border-color: rgba(0, 217, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .gptdetector-textarea-wrapper {
    background: #151B2C;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .gptdetector-textarea-wrapper:focus-within {
    box-shadow: 0 0 0 3px rgba(0, 217, 255, 0.1);
}

[data-theme="dark"] .gptdetector-word-counter {
    background: #0A0F1C;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .gptdetector-results {
    background: #1A2332;
    border-color: rgba(0, 217, 255, 0.15);
}

[data-theme="dark"] .gptdetector-result-card {
    background: #151B2C;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .gptdetector-limits-info {
    background: #151B2C;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Score Gauge Section */
.gptdetector-score-gauge {
    text-align: center;
    padding: 2rem 0;
    margin-bottom: 2rem;
}

.gptdetector-gauge-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.gptdetector-gauge-svg {
    width: 100%;
    height: 100%;
}

.gptdetector-gauge-background {
    fill: none;
    stroke: var(--bg-hover);
    stroke-width: 20;
}

.gptdetector-gauge-fill {
    fill: none;
    stroke-width: 20;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease-in-out;
}

.gptdetector-gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.gptdetector-gauge-percentage {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--text-primary);
    display: block;
}

.gptdetector-gauge-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

/* Model Cards */
.gptdetector-models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}

.gptdetector-model-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.gptdetector-model-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.gptdetector-model-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.gptdetector-model-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.gptdetector-model-percentage {
    font-weight: bold;
    font-size: 1.125rem;
}

.gptdetector-model-progress {
    background: var(--bg-hover);
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.gptdetector-model-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* Sentence Highlighting */
.gptdetector-highlighted-text {
    line-height: 1.8;
    font-size: 1rem;
    color: var(--text-primary);
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

.gptdetector-sentence {
    display: inline;
    padding: 2px 4px;
    margin: 0 2px;
    border-radius: 3px;
    transition: all 0.3s ease;
}

.gptdetector-sentence.human {
    background: rgba(var(--success-rgb), 0.2);
    color: var(--text-primary);
}

.gptdetector-sentence.ai {
    background: rgba(var(--warning-rgb), 0.2);
    color: var(--text-primary);
}

.gptdetector-sentence.mixed {
    background: rgba(var(--info-rgb), 0.2);
    color: var(--text-primary);
}

/* Metrics Section */
.gptdetector-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.gptdetector-metric-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.gptdetector-metric-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    display: block;
    margin-bottom: 0.25rem;
}

.gptdetector-metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Improvements Section */
.gptdetector-improvements {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.gptdetector-improvements-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.gptdetector-improvements-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.gptdetector-improvement-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.gptdetector-improvement-icon {
    width: 20px;
    height: 20px;
    margin-right: 0.75rem;
    flex-shrink: 0;
    color: var(--primary);
}

/* Result Headings and Text */
.gptdetector-result-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.gptdetector-result-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.gptdetector-result-text {
    color: var(--text-primary);
    line-height: 1.6;
}

/* Detection Score Colors */
.gptdetector-score-high {
    color: var(--danger);
}

.gptdetector-score-medium {
    color: var(--warning);
}

.gptdetector-score-low {
    color: var(--success);
}

/* Light Theme Specific - Results */
[data-theme="light"] {
    --success-rgb: 0, 181, 116;
    --warning-rgb: 245, 158, 11;
    --info-rgb: 0, 119, 204;
}

/* All text elements in results */
[data-theme="light"] .gptdetector-results * {
    color: #1A1A1A;
}

[data-theme="light"] .gptdetector-results h1,
[data-theme="light"] .gptdetector-results h2,
[data-theme="light"] .gptdetector-results h3,
[data-theme="light"] .gptdetector-results h4,
[data-theme="light"] .gptdetector-results h5,
[data-theme="light"] .gptdetector-results h6 {
    color: #1A1A1A !important;
}

/* Models Section - Light Mode */
[data-theme="light"] .gptdetector-models-section {
    background: #FAF9F7;
    border: 1px solid #B8B4AD;
    border-radius: 8px;
    padding: 1.5rem;
}

[data-theme="light"] .model-item,
[data-theme="light"] .ai-model {
    background: #FFFFFF;
    border: 1px solid #B8B4AD;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 0.75rem;
}

/* Metrics Section - Light Mode */
[data-theme="light"] .gptdetector-metrics-section {
    background: #FAF9F7;
    border: 1px solid #B8B4AD;
    border-radius: 8px;
    padding: 1.5rem;
}

[data-theme="light"] .metric-item {
    background: #FFFFFF;
    border: 1px solid #B8B4AD;
    border-radius: 6px;
    padding: 1rem;
}

/* Improvement Prompt - Light Mode */
[data-theme="light"] .improvement-prompt {
    background: #FAF9F7;
    border: 1px solid #B8B4AD;
    border-radius: 8px;
    padding: 1.5rem;
}

/* Sentences Section - Light Mode */
[data-theme="light"] .gptdetector-sentences-section {
    background: #FAF9F7;
    border: 1px solid #B8B4AD;
    border-radius: 8px;
    padding: 1.5rem;
}

[data-theme="light"] .sentence-legend {
    background: #FFFFFF;
    border: 1px solid #B8B4AD;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

/* Analyze Button - Light Mode */
[data-theme="light"] .gptdetector-analyze-btn,
[data-theme="light"] #gptdetector-analyze-btn {
    background: linear-gradient(135deg, #0077CC 0%, #0088DD 100%);
    color: #FFFFFF;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 119, 204, 0.25);
    transition: all 0.3s ease;
}

[data-theme="light"] .gptdetector-analyze-btn:hover,
[data-theme="light"] #gptdetector-analyze-btn:hover {
    background: linear-gradient(135deg, #0066B3 0%, #0077CC 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 119, 204, 0.35);
}

/* Loading State - Light Mode */
[data-theme="light"] .gptdetector-loading {
    background: #FFFFFF;
    border: 1px solid #B8B4AD;
    border-radius: 8px;
    padding: 2rem;
    color: #3D3D3D;
}

[data-theme="light"] .gptdetector-spinner {
    border: 3px solid #E5E2DD;
    border-top: 3px solid #0077CC;
}

[data-theme="light"] .gptdetector-results p,
[data-theme="light"] .gptdetector-results span,
[data-theme="light"] .gptdetector-results div {
    color: inherit;
}

[data-theme="light"] .gptdetector-gauge-background {
    stroke: #E5E2DD;
}

[data-theme="light"] .gptdetector-gauge-fill {
    stroke: url(#gauge-gradient-light);
}

[data-theme="light"] .gptdetector-gauge-percentage {
    color: #1A1A1A;
}

[data-theme="light"] .gptdetector-result-title {
    color: #1A1A1A;
}

[data-theme="light"] .gptdetector-result-subtitle {
    color: #3D3D3D;
}

[data-theme="light"] .gptdetector-result-text {
    color: #2A2A2A;
}

[data-theme="light"] .gptdetector-model-card {
    background: #FFFFFF;
    border-color: #D0CCC6;
}

[data-theme="light"] .gptdetector-model-card:hover {
    border-color: #0077CC;
    box-shadow: 0 4px 12px rgba(0, 119, 204, 0.15);
}

[data-theme="light"] .gptdetector-model-name {
    color: #1A1A1A;
}

[data-theme="light"] .gptdetector-model-percentage {
    color: #0077CC;
}

[data-theme="light"] .gptdetector-model-progress {
    background: #E5E2DD;
}

[data-theme="light"] .gptdetector-model-progress-bar {
    background: linear-gradient(90deg, #0077CC 0%, #00B574 100%);
}

[data-theme="light"] .gptdetector-highlighted-text {
    background: #FFFFFF;
    border-color: #D0CCC6;
    color: #1A1A1A;
}

[data-theme="light"] .gptdetector-sentence.human {
    background: rgba(0, 181, 116, 0.15);
    color: #1A1A1A;
}

[data-theme="light"] .gptdetector-sentence.ai {
    background: rgba(245, 158, 11, 0.15);
    color: #1A1A1A;
}

[data-theme="light"] .gptdetector-sentence.mixed {
    background: rgba(0, 119, 204, 0.15);
    color: #1A1A1A;
}

[data-theme="light"] .gptdetector-metric-card {
    background: #FFFFFF;
    border-color: #D0CCC6;
}

[data-theme="light"] .gptdetector-metric-value {
    color: #0077CC;
}

[data-theme="light"] .gptdetector-metric-label {
    color: #5A5A5A;
}

[data-theme="light"] .gptdetector-improvements {
    background: #FAF9F7;
    border-color: #D0CCC6;
}

[data-theme="light"] .gptdetector-improvements-title {
    color: #1A1A1A;
}

[data-theme="light"] .gptdetector-improvement-item {
    color: #3D3D3D;
}

[data-theme="light"] .gptdetector-improvement-icon {
    color: #0077CC;
}

/* Dark Theme Specific - Results */
[data-theme="dark"] {
    --success-rgb: 0, 245, 160;
    --warning-rgb: 255, 184, 0;
    --info-rgb: 0, 217, 255;
}

[data-theme="dark"] .gptdetector-gauge-background {
    stroke: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .gptdetector-gauge-fill {
    stroke: url(#gauge-gradient-dark);
}

[data-theme="dark"] .gptdetector-model-progress-bar {
    background: linear-gradient(90deg, #00D9FF 0%, #00F5A0 100%);
}

[data-theme="dark"] .gptdetector-sentence.human {
    background: rgba(0, 245, 160, 0.2);
    color: #FFFFFF;
}

[data-theme="dark"] .gptdetector-sentence.ai {
    background: rgba(255, 184, 0, 0.2);
    color: #FFFFFF;
}

[data-theme="dark"] .gptdetector-sentence.mixed {
    background: rgba(0, 217, 255, 0.2);
    color: #FFFFFF;
}

/* SVG Gradient Definitions */
.gptdetector-svg-defs {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .gptdetector-input-section {
        padding: 1rem;
    }
    
    .gptdetector-source-options {
        flex-direction: column;
    }
    
    .gptdetector-btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.95rem;
    }
    
    .gptdetector-models-grid {
        grid-template-columns: 1fr;
    }
    
    .gptdetector-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}