/* ============================================
   Structured Data Extractor - Modern UI
   ============================================ */

/* CSS Variables for theming */
:root {
    --se-primary: #6366f1;
    --se-primary-dark: #4f46e5;
    --se-secondary: #8b5cf6;
    --se-success: #10b981;
    --se-warning: #f59e0b;
    --se-error: #ef4444;
    --se-bg: #ffffff;
    --se-surface: #f8fafc;
    --se-surface-hover: #f1f5f9;
    --se-text: #1e293b;
    --se-text-secondary: #64748b;
    --se-border: #e2e8f0;
    --se-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --se-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --se-radius: 12px;
    --se-radius-sm: 8px;
    --se-transition: all 0.3s ease;
}

/* Dark mode variables */
[data-theme="dark"] {
    --se-bg: #0f172a;
    --se-surface: #1e293b;
    --se-surface-hover: #334155;
    --se-text: #f1f5f9;
    --se-text-secondary: #94a3b8;
    --se-border: #334155;
    --se-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --se-shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

/* Container */
.schema-extractor-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--se-text);
    background: var(--se-bg);
    line-height: 1.6;
}

/* Header Section */
.se-header {
    text-align: center;
    margin-bottom: 3rem;
}

.se-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--se-primary) 0%, var(--se-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.se-header p {
    font-size: 1.125rem;
    color: var(--se-text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* Theme Toggle */
.se-theme-toggle {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--se-surface);
    border: 1px solid var(--se-border);
    border-radius: 50px;
    padding: 0.5rem;
    cursor: pointer;
    transition: var(--se-transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--se-text-secondary);
}

.se-theme-toggle:hover {
    background: var(--se-surface-hover);
}

.se-theme-toggle .toggle-icon {
    width: 20px;
    height: 20px;
}

/* Main Card */
.se-card {
    background: var(--se-surface);
    border-radius: var(--se-radius);
    box-shadow: var(--se-shadow-lg);
    padding: 2.5rem;
    margin-bottom: 3rem;
    border: 1px solid var(--se-border);
    position: relative;
}

/* Input Section */
.se-input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.se-input-wrapper {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.se-input {
    width: 100%;
    padding: 1rem 1.25rem;
    font-size: 1rem;
    border: 2px solid var(--se-border);
    border-radius: var(--se-radius-sm);
    background: var(--se-bg);
    color: var(--se-text);
    transition: var(--se-transition);
    box-sizing: border-box;
}

.se-input:focus {
    outline: none;
    border-color: var(--se-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.se-input::placeholder {
    color: var(--se-text-secondary);
}

/* Buttons */
.se-btn {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--se-radius-sm);
    cursor: pointer;
    transition: var(--se-transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.se-btn-primary {
    background: linear-gradient(135deg, var(--se-primary) 0%, var(--se-primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.2);
}

.se-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.3);
}

.se-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.se-btn-secondary {
    background: var(--se-surface-hover);
    color: var(--se-text);
    border: 1px solid var(--se-border);
}

.se-btn-secondary:hover {
    background: var(--se-border);
}

.se-btn-success {
    background: var(--se-success);
    color: white;
}

/* Loading Animation */
.se-loading {
    display: none;
    text-align: center;
    padding: 3rem;
}

.se-loading.active {
    display: block;
}

.se-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--se-border);
    border-top-color: var(--se-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.se-loading p {
    color: var(--se-text-secondary);
    font-size: 1.125rem;
}

/* Results Section */
.se-results {
    display: none;
    margin-top: 2rem;
    animation: fadeIn 0.5s ease;
}

.se-results.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Tabs */
.se-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--se-border);
    padding-bottom: 0;
}

.se-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    color: var(--se-text-secondary);
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: var(--se-transition);
}

.se-tab:hover {
    color: var(--se-primary);
}

.se-tab.active {
    color: var(--se-primary);
}

.se-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--se-primary);
}

/* Tab Content */
.se-tab-content {
    display: none;
}

.se-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* Code Preview */
.se-code-block {
    background: #1e1e1e;
    border-radius: var(--se-radius-sm);
    padding: 1.5rem;
    overflow-x: auto;
    position: relative;
    max-height: 500px;
    overflow-y: auto;
}

.se-code-block pre {
    margin: 0;
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
}

.se-code-block .key { color: #9cdcfe; }
.se-code-block .string { color: #ce9178; }
.se-code-block .number { color: #b5cea8; }
.se-code-block .boolean { color: #569cd6; }
.se-code-block .null { color: #569cd6; }

/* Copy Button */
.se-copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: var(--se-radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--se-transition);
}

.se-copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.se-copy-btn.copied {
    background: var(--se-success);
}

/* Stats Grid */
.se-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.se-stat-card {
    background: var(--se-bg);
    padding: 1.5rem;
    border-radius: var(--se-radius-sm);
    border: 1px solid var(--se-border);
    text-align: center;
}

.se-stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--se-primary);
    margin-bottom: 0.25rem;
}

.se-stat-label {
    font-size: 0.875rem;
    color: var(--se-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Download Options */
.se-download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.se-download-card {
    background: var(--se-bg);
    border: 2px solid var(--se-border);
    border-radius: var(--se-radius-sm);
    padding: 2rem;
    text-align: center;
    transition: var(--se-transition);
    cursor: pointer;
}

.se-download-card:hover {
    border-color: var(--se-primary);
    transform: translateY(-4px);
    box-shadow: var(--se-shadow);
}

.se-download-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--se-primary) 0%, var(--se-secondary) 100%);
    border-radius: var(--se-radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.se-download-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--se-text);
}

.se-download-desc {
    font-size: 0.875rem;
    color: var(--se-text-secondary);
    margin-bottom: 1.5rem;
}

/* Error Message */
.se-error {
    display: none;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 1rem 1.5rem;
    border-radius: var(--se-radius-sm);
    margin-top: 1rem;
    align-items: center;
    gap: 0.75rem;
}

[data-theme="dark"] .se-error {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fecaca;
}

.se-error.active {
    display: flex;
}

/* Success Message */
.se-success-msg {
    display: none;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 1rem 1.5rem;
    border-radius: var(--se-radius-sm);
    margin-top: 1rem;
}

[data-theme="dark"] .se-success-msg {
    background: #052e16;
    border-color: #166534;
    color: #bbf7d0;
}

.se-success-msg.active {
    display: block;
}

/* Schema Type Tags */
.se-schema-types {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.se-schema-tag {
    background: linear-gradient(135deg, var(--se-primary) 0%, var(--se-secondary) 100%);
    color: white;
    padding: 0.375rem 0.875rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
}

/* SEO Content Section */
.seo-content {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 2px solid var(--se-border);
}

.seo-content h1 {
    font-size: 2.25rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--se-text);
    line-height: 1.2;
}

.seo-content h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--se-text);
}

.seo-content h3 {
    font-size: 1.375rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    color: var(--se-text);
}

.seo-content p {
    margin-bottom: 1.25rem;
    color: var(--se-text-secondary);
    line-height: 1.8;
}

.seo-content ul, .seo-content ol {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.seo-content li {
    margin-bottom: 0.75rem;
    color: var(--se-text-secondary);
}

.seo-content strong {
    color: var(--se-text);
    font-weight: 600;
}

.seo-content a {
    color: var(--se-primary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: var(--se-transition);
}

.seo-content a:hover {
    border-bottom-color: var(--se-primary);
}

.seo-content code {
    background: var(--se-surface-hover);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--se-primary);
}

/* FAQ Section */
.seo-faq {
    margin-top: 2rem;
}

.faq-item {
    background: var(--se-surface);
    border: 1px solid var(--se-border);
    border-radius: var(--se-radius-sm);
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-question {
    padding: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--se-transition);
}

.faq-question:hover {
    background: var(--se-surface-hover);
}

.faq-answer {
    padding: 0 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.active .faq-answer {
    padding: 0 1.25rem 1.25rem;
    max-height: 500px;
}

.faq-icon {
    transition: transform 0.3s ease;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

/* Breadcrumb */
.se-breadcrumb {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    font-size: 0.875rem;
    color: var(--se-text-secondary);
}

.se-breadcrumb a {
    color: var(--se-primary);
    text-decoration: none;
}

.se-breadcrumb a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .schema-extractor-wrap {
        padding: 1rem;
    }
    
    .se-header h2 {
        font-size: 1.875rem;
    }
    
    .se-card {
        padding: 1.5rem;
    }
    
    .se-input-group {
        flex-direction: column;
    }
    
    .se-btn {
        width: 100%;
        justify-content: center;
    }
    
    .se-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    
    .se-code-block {
        padding: 1rem;
    }
    
    .seo-content h1 {
        font-size: 1.75rem;
    }
    
    .seo-content h2 {
        font-size: 1.375rem;
    }
}

/* Print styles */
@media print {
    .se-theme-toggle,
    .se-input-group,
    .se-tabs,
    .se-copy-btn {
        display: none !important;
    }
    
    .se-code-block {
        max-height: none;
        overflow: visible;
        white-space: pre-wrap;
        word-wrap: break-word;
    }
}