/* Современный дизайн для AI Content Generator */

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

header h1 {
    text-align: center;
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 30px;
    font-weight: 700;
}

nav {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-btn {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.nav-btn.active {
    background: linear-gradient(145deg, #e74c3c, #c0392b);
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.4);
}

.nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.nav-btn:hover::before {
    left: 100%;
}

main {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h2 {
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 2rem;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
}

input[type="text"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: white;
}

input[type="text"]:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.btn-primary,
.btn-secondary {
    background: linear-gradient(145deg, #3498db, #2980b9);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: linear-gradient(145deg, #27ae60, #219a52);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(39, 174, 96, 0.4);
}

.loading {
    text-align: center;
    padding: 40px;
    background: rgba(52, 152, 219, 0.1);
    border-radius: 15px;
    margin: 20px 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e6ed;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.result {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
    border-left: 5px solid #27ae60;
}

.result-item {
    margin-bottom: 25px;
}

.result-item h4 {
    color: #2c3e50;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.result-item p,
.result-item div {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #e0e6ed;
    line-height: 1.6;
}

.seo-result {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 30px;
    margin: 20px 0;
}

.seo-stats table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.seo-stats th,
.seo-stats td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e6ed;
}

.seo-stats th {
    background: #34495e;
    color: white;
    font-weight: 600;
}

.seo-stats tr:hover {
    background: #f8f9fa;
}

.warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 15px;
    border-radius: 10px;
    margin: 10px 0;
}

.article-item {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.article-item:hover {
    transform: translateY(-5px);
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 15px;
}

.article-info h3 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.article-info .date {
    color: #7f8c8d;
    font-size: 14px;
}

.article-info .keywords {
    color: #3498db;
    font-size: 14px;
    margin-top: 5px;
}

.article-actions {
    display: flex;
    gap: 10px;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 20px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-view {
    background: #3498db;
    color: white;
}

.btn-delete {
    background: #e74c3c;
    color: white;
}

.btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.article-content {
    margin-top: 20px;
    padding: 20px;
    background: #ffffff;
    border-radius: 10px;
    border-left: 4px solid #3498db;
    line-height: 1.8;
    font-size: 16px;
}

.article-content h2 {
    color: #2c3e50;
    margin: 25px 0 15px 0;
    font-size: 1.5em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

.article-content h3 {
    color: #34495e;
    margin: 20px 0 12px 0;
    font-size: 1.3em;
}

.article-content p {
    margin: 15px 0;
    text-align: justify;
}

.article-content ul,
.article-content ol {
    margin: 15px 0;
    padding-left: 25px;
}

.article-content li {
    margin: 8px 0;
}

.article-content strong {
    color: #2c3e50;
    font-weight: 600;
}

.article-title,
.article-meta,
.article-keywords {
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e6ed;
    margin: 10px 0;
}

.article-title {
    font-size: 1.4em;
    font-weight: bold;
    color: #2c3e50;
}

.article-meta {
    font-style: italic;
    color: #7f8c8d;
}

.article-keywords {
    color: #3498db;
    font-weight: 500;
}

/* Стили для вкладок чатов */
.chat-tabs-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #e0e6ed;
    padding-bottom: 10px;
}

.chat-tabs {
    display: flex;
    flex: 1;
    gap: 5px;
}

.chat-tab {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f8f9fa;
    border: 1px solid #e0e6ed;
    border-radius: 8px 8px 0 0;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-width: 120px;
}

.chat-tab.active {
    background: #ffffff;
    border-bottom: 1px solid #ffffff;
    margin-bottom: -1px;
}

.chat-tab:hover {
    background: #e8f4f8;
}

.chat-tab span {
    flex: 1;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background-color 0.3s ease;
    pointer-events: none;
    /* Делаем span некликабельным */
    cursor: default;
}

.chat-tab span:hover {
    background: rgba(52, 152, 219, 0.1);
}

.tab-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.edit-tab {
    background: none;
    border: none;
    color: #6c757d;
    font-size: 8px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}



.chat-tab input.edit-name {
    flex: 1;
    font-size: 14px;
    border: 1px solid #3498db;
    border-radius: 3px;
    padding: 2px 4px;
    background: white;
    pointer-events: auto;
    /* Включаем события для input */
    cursor: text;
}

.close-tab {
    background: none;
    border: none;
    color: #dc3545;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    padding: 2px 4px;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.3s ease;
}


.add-chat-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    margin-left: 10px;
}

.add-chat-btn:hover {
    background: #218838;
}

/* Стили для действий со статьями */
.article-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    border: 2px solid #e0e6ed;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    background: white;
}

.message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 15px;
    max-width: 80%;
}

.message.user {
    background: #3498db;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.message.ai {
    background: #ecf0f1;
    color: #2c3e50;
    margin-right: auto;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 5px;
}

.chat-input {
    display: flex;
    gap: 10px;
}

.chat-input input {
    flex: 1;
}

.hidden {
    display: none !important;
}

/* Эффект печатания */
.typing-effect {
    border-right: 2px solid #3498db;
    animation: blink 1s infinite;
}

/* Эффект "думания" для чата */
.thinking-message {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 15px;
    padding: 15px 20px;
    margin: 10px 0;
    max-width: 70%;
    align-self: flex-start;
    position: relative;
    overflow: hidden;
}

.thinking-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6c757d;
    font-style: italic;
}

.thinking-dots {
    display: flex;
    gap: 4px;
}

.thinking-dot {
    width: 8px;
    height: 8px;
    background-color: #6c757d;
    border-radius: 50%;
    animation: thinking-pulse 1.5s infinite ease-in-out;
}

.thinking-dot:nth-child(1) {
    animation-delay: 0s;
}

.thinking-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinking-pulse {

    0%,
    60%,
    100% {
        opacity: 0.3;
        transform: scale(0.8);
    }

    30% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes blink {

    0%,
    50% {
        border-color: #3498db;
    }

    51%,
    100% {
        border-color: transparent;
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header h1 {
        font-size: 2rem;
    }

    nav {
        flex-direction: column;
    }

    .nav-btn {
        width: 100%;
        margin: 5px 0;
    }

    .article-header {
        flex-direction: column;
        gap: 15px;
    }

    .article-actions {
        align-self: flex-start;
    }

    .message {
        max-width: 95%;
    }

    .chat-input {
        flex-direction: column;
    }
}

@media (max-width: 480px) {

    header,
    main {
        padding: 20px;
    }

    h2 {
        font-size: 1.5rem;
    }
}

/* Стили для плейсхолдеров изображений */
.image-placeholder {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%) !important;
    border: 2px dashed #6c757d !important;
    padding: 20px !important;
    margin: 15px 0 !important;
    text-align: center !important;
    border-radius: 8px !important;
    transition: all 0.3s ease;
}

.image-placeholder:hover {
    background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%) !important;
    border-color: #495057 !important;
}

.image-placeholder p {
    margin: 0 !important;
    color: #495057 !important;
    font-style: italic !important;
    line-height: 1.5;
}

.image-placeholder strong {
    color: #212529 !important;
    font-weight: 600;
}

/* Улучшенные стили для SEO анализа */
.seo-analysis h3 {
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
    margin-top: 20px;
    margin-bottom: 15px;
}

.seo-analysis ul {
    margin-bottom: 15px;
}

.seo-analysis li {
    margin-bottom: 8px;
    line-height: 1.5;
}