:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --secondary-color: #10b981;
    --background: #ffffff;
    --surface: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --error: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    background: var(--background);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 1200px;
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
    color: white;
    padding: 30px;
    text-align: center;
}

.title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.logo {
    width: 45px;
    height: 45px;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.95;
    margin-bottom: 20px;
}

.language-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.lang-btn.active {
    background: white;
    color: var(--primary-color);
}

main {
    padding: 30px;
}

.input-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.url-input-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 25px;
}

.url-input-group label {
    font-weight: 600;
    color: var(--text-primary);
}

#url-input {
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

#url-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.primary-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.primary-btn svg {
    width: 20px;
    height: 20px;
}

.options-section h3 {
    margin-bottom: 15px;
    color: var(--text-primary);
}

.option-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.checkbox-label:hover {
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.selector-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.selector-input {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.selector-input label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.selector-input input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
}

.cors-option {
    display: flex;
    align-items: center;
    gap: 10px;
}

.help-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.results-section {
    background: var(--surface);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 25px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.results-header h2 {
    color: var(--text-primary);
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.export-btn {
    background: white;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.export-btn:hover {
    background: var(--surface);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.export-btn svg {
    width: 16px;
    height: 16px;
}

.results-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--text-primary);
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.results-content {
    background: white;
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
    max-height: 500px;
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.text-content p {
    margin-bottom: 12px;
    line-height: 1.6;
    color: var(--text-primary);
}

.links-list {
    list-style: none;
}

.links-list li {
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.links-list li:last-child {
    border-bottom: none;
}

.links-list a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.links-list a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.image-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.image-item:hover {
    transform: scale(1.05);
}

.image-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.image-info {
    padding: 10px;
    background: var(--surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.image-info small {
    color: var(--text-secondary);
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60%;
}

.image-info a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.meta-list {
    display: grid;
    gap: 10px;
}

.meta-list dt {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.meta-list dd {
    color: var(--text-primary);
    margin-left: 20px;
    word-break: break-word;
}

.structured-data {
    background: var(--surface);
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    overflow-x: auto;
    color: var(--text-primary);
}

.stats-bar {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 1.1rem;
}

.error-message {
    background: var(--error);
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.error-message.success {
    background: var(--success);
}

.error-message.warning {
    background: var(--warning);
}

.error-message svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px;
    font-style: italic;
}

footer {
    background: var(--surface);
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-top: 1px solid var(--border);
}

@media (max-width: 768px) {
    .title {
        font-size: 2rem;
    }
    
    .selector-group {
        grid-template-columns: 1fr;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .export-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .export-btn {
        flex: 1;
    }
    
    .results-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .images-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    .container {
        border-radius: 0;
    }
    
    body {
        padding: 0;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .logo {
        width: 35px;
        height: 35px;
    }
    
    header {
        padding: 20px;
    }
    
    main {
        padding: 20px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}