/**
 * WPGIS Frontend Styles
 * Enhanced version inspired by modern AI interfaces
 */

/* Общие стили виджета */
.wpgis-search-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    padding: 40px;
    margin: 20px auto;
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.wpgis-search-widget::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* Заголовок */
.wpgis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.wpgis-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
}

.wpgis-icon {
    font-size: 32px;
    margin-right: 10px;
}

.wpgis-theme-toggle {
    background: none;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.2s ease;
}

.wpgis-theme-toggle:hover {
    background: #f5f5f5;
    border-color: #0073aa;
}

/* Контент */
.wpgis-content {
    display: flex;
    gap: 30px;
}

/* Боковая панель */
.wpgis-sidebar {
    flex: 0 0 250px;
    background: #f9f9f9;
    border-radius: 8px;
    padding: 20px;
}

.wpgis-sidebar h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
}

.wpgis-history-list {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.wpgis-history-item {
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 3px solid #0073aa;
}

.wpgis-history-item:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

.wpgis-history-query {
    font-size: 13px;
    color: #333;
    margin-bottom: 5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wpgis-history-time {
    font-size: 11px;
    color: #999;
}

/* Главная область */
.wpgis-main {
    flex: 1;
}

.wpgis-welcome {
    text-align: center;
    margin-bottom: 30px;
}

.wpgis-welcome p {
    font-size: 18px;
    color: #666;
    margin: 0;
}

/* Карточки сценариев */
.wpgis-scenarios {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.wpgis-scenario-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 20px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.wpgis-scenario-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.wpgis-scenario-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.wpgis-scenario-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.wpgis-scenario-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.wpgis-scenario-card:nth-child(5) {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.wpgis-scenario-card:nth-child(6) {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
}

.wpgis-scenario-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.wpgis-scenario-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.wpgis-scenario-description {
    font-size: 12px;
    opacity: 0.9;
    line-height: 1.4;
}

/* Область ввода */
.wpgis-input-area {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 25px;
}

.wpgis-field {
    margin-bottom: 20px;
}

.wpgis-field label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.wpgis-select,
.wpgis-textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.wpgis-select:focus,
.wpgis-textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.wpgis-textarea {
    resize: vertical;
    min-height: 80px;
}

/* Кнопки */
.wpgis-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.wpgis-btn-primary {
    background: #0073aa;
    color: #fff;
    width: 100%;
    justify-content: center;
}

.wpgis-btn-primary:hover {
    background: #005a87;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 115, 170, 0.3);
}

.wpgis-btn-secondary {
    background: #f5f5f5;
    color: #333;
}

.wpgis-btn-secondary:hover {
    background: #e0e0e0;
}

.wpgis-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wpgis-clear-history {
    width: 100%;
    font-size: 12px;
    padding: 8px 12px;
}

/* Результат */
.wpgis-result-area {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 25px;
    margin-top: 20px;
}

.wpgis-result-area h3 {
    margin: 0 0 15px 0;
    color: #333;
}

.wpgis-result-content {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    border-left: 4px solid #0073aa;
    margin-bottom: 15px;
    line-height: 1.8;
    color: #333;
    font-size: 15px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Типография для печатающегося текста */
.wpgis-result-content.typing {
    position: relative;
}

.wpgis-result-content.typing::after {
    content: '▋';
    display: inline-block;
    animation: blink 1s infinite;
    margin-left: 2px;
    color: #0073aa;
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

/* Форматированный контент */
.wpgis-result-content h2,
.wpgis-result-content h3 {
    margin-top: 20px;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1a1a1a;
}

.wpgis-result-content h2 {
    font-size: 20px;
}

.wpgis-result-content h3 {
    font-size: 17px;
}

.wpgis-result-content ul {
    margin: 15px 0;
    padding-left: 25px;
}

.wpgis-result-content li {
    margin: 8px 0;
    line-height: 1.6;
}

.wpgis-result-content strong {
    color: #0073aa;
    font-weight: 600;
}

.wpgis-result-content code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #d63384;
}

.wpgis-result-content p {
    margin: 12px 0;
}

.wpgis-result-meta {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
}

.wpgis-result-actions {
    display: flex;
    gap: 10px;
}

/* Загрузка */
.wpgis-loading {
    text-align: center;
    padding: 40px;
}

.wpgis-spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: wpgis-spin 1s linear infinite;
}

@keyframes wpgis-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.wpgis-loading p {
    font-size: 16px;
    color: #666;
}

/* Ошибка */
.wpgis-error {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.wpgis-error-icon {
    font-size: 24px;
}

.wpgis-error-text {
    color: #856404;
}

/* Темная тема */
.wpgis-search-widget--dark {
    background: #1a1a1a;
    color: #e0e0e0;
}

.wpgis-search-widget--dark .wpgis-title {
    color: #fff;
}

.wpgis-search-widget--dark .wpgis-header {
    border-bottom-color: #333;
}

.wpgis-search-widget--dark .wpgis-sidebar {
    background: #222;
}

.wpgis-search-widget--dark .wpgis-history-item {
    background: #2a2a2a;
    color: #e0e0e0;
}

.wpgis-search-widget--dark .wpgis-input-area,
.wpgis-search-widget--dark .wpgis-result-area {
    background: #222;
}

.wpgis-search-widget--dark .wpgis-select,
.wpgis-search-widget--dark .wpgis-textarea {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

.wpgis-search-widget--dark .wpgis-result-content {
    background: #2a2a2a;
    color: #e0e0e0;
}

/* Адаптивность */
@media (max-width: 768px) {
    .wpgis-search-widget {
        padding: 20px;
    }
    
    .wpgis-content {
        flex-direction: column;
    }
    
    .wpgis-sidebar {
        flex: 1;
        order: 2;
    }
    
    .wpgis-scenarios {
        grid-template-columns: 1fr;
    }
    
    .wpgis-result-actions {
        flex-direction: column;
    }
    
    .wpgis-result-actions .wpgis-btn {
        width: 100%;
    }
}


