/* Основные стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

#app {
    max-width: 500px;
    margin: 0 auto;
    position: relative;
}

/* Карточки */
.card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 20px;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 25px;
    font-size: 24px;
}

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

input {
    width: 100%;
    padding: 14px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: #667eea;
}

button {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: transform 0.2s;
}

button:hover {
    transform: translateY(-2px);
}

button.secondary {
    background: #6c757d;
}

button.danger {
    background: #dc3545;
}

button.success {
    background: #28a745;
}

.error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.error.show {
    display: block;
}

.success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.success.show {
    display: block;
}

.link {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.link a {
    color: #667eea;
    text-decoration: none;
}

.link a:hover {
    text-decoration: underline;
}

/* Дебаг панель */
.debug-panel {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    max-height: 500px;
    background: rgba(0, 0, 0, 0.95);
    color: white;
    border-radius: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    z-index: 10000;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border: 1px solid #444;
    display: none;
}

.debug-panel.active {
    display: flex;
    flex-direction: column;
}

.debug-header {
    padding: 12px 15px;
    background: #222;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #444;
}

.debug-title {
    font-weight: bold;
    color: #4cd964;
}

.debug-controls {
    display: flex;
    gap: 5px;
}

.debug-controls button {
    width: auto;
    padding: 6px 12px;
    font-size: 12px;
    margin: 0;
    background: #555;
    border-radius: 4px;
}

.debug-controls button:hover {
    transform: none;
    background: #666;
}

.debug-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
}

.debug-log {
    font-size: 11px;
    line-height: 1.4;
}

.log-entry {
    padding: 4px 0;
    border-bottom: 1px solid #333;
    word-break: break-all;
}

.log-entry.info { color: #5ac8fa; }
.log-entry.success { color: #4cd964; }
.log-entry.warning { color: #ff9500; }
.log-entry.error { color: #ff3b30; }

.debug-footer {
    padding: 10px 15px;
    background: #222;
    border-top: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.debug-status {
    font-size: 11px;
    color: #8e8e93;
}

.debug-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s;
}

.debug-toggle:hover {
    transform: scale(1.1);
}

/* Статус бар */
.status-bar {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 14px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Чат интерфейс */
.chat-container {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    height: 70vh;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid #e1e5e9;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    margin: 0;
}

.chat-input-area button {
    width: auto;
    padding: 12px 25px;
    margin: 0;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
}

.message.sent {
    margin-left: auto;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.sent .message-content {
    background: #667eea;
    color: white;
}

.message-info {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
    text-align: right;
}

/* Загрузка */
.loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #667eea;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* Тестовые кнопки */
.test-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.test-buttons button {
    width: auto;
    flex: 1;
    min-width: 120px;
}

/* Адаптивность */
@media (max-width: 600px) {
    #app { max-width: 100%; }
    .card { padding: 20px; }
    .debug-panel {
        width: calc(100% - 40px);
        max-height: 60vh;
        right: 20px;
        left: 20px;
    }
    .chat-container { height: 80vh; }
}