/* Сброс стилей */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Основные стили */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background: #f7f8fa;
    color: #2c2d2e;
    line-height: 1.4;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

.vk-app {
    max-width: 100vw;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

/* Заголовок */
.header {
    background: #5181b8;
    color: white;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.header-title {
    font-size: 16px;
    font-weight: 500;
}

.update-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

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

.update-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Контент */
.content {
    padding: 16px;
}

/* Статус базы данных */
.database-status {
    background: #f0f2f5;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}

.status-text {
    color: #626d7a;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4bb34b;
    margin-right: 8px;
}

.status-indicator.loading {
    background: #ffa000;
    animation: pulse 1s infinite;
}

.status-indicator.error {
    background: #e64646;
}

/* Информация о базах данных */
.database-info {
    background: #f0f2f5;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.db-status {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.db-item {
    background: white;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #d3d9de;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.db-name {
    font-size: 12px;
    color: #626d7a;
    margin-bottom: 4px;
}

.db-count {
    font-size: 16px;
    font-weight: 600;
    color: #5181b8;
    margin-bottom: 4px;
}

.db-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4bb34b;
}

.db-status-indicator.loading {
    background: #ffa000;
    animation: pulse 1s infinite;
}

.db-status-indicator.error {
    background: #e64646;
}

/* Статистика */
.stats {
    background: #f0f2f5;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.stats-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.stat-item {
    text-align: center;
    padding: 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #d3d9de;
}

.stat-number {
    font-weight: 600;
    font-size: 16px;
    color: #5181b8;
}

.stat-label {
    font-size: 12px;
    color: #626d7a;
}

/* Табы */
.tabs {
    display: flex;
    background: #f0f2f5;
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    color: #626d7a;
}

.tab.active {
    background: white;
    color: #2c2d2e;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tab-content {
    display: none;
}

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

/* Поля ввода */
.input-section {
    margin-bottom: 20px;
}

.input-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c2d2e;
    font-size: 14px;
}

.input-field {
    width: 100%;
    padding: 12px;
    border: 1px solid #d3d9de;
    border-radius: 8px;
    font-size: 16px;
    background: white;
    transition: border-color 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: #5181b8;
    box-shadow: 0 0 0 2px rgba(81, 129, 184, 0.2);
}

/* Опции проверки */
.check-options {
    background: #f0f2f5;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}

.option-group {
    margin-bottom: 8px;
}

.option-group:last-child {
    margin-bottom: 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid #d3d9de;
    border-radius: 4px;
    margin-right: 8px;
    position: relative;
    transition: all 0.2s;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background: #5181b8;
    border-color: #5181b8;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark:after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Кнопки */
.check-button {
    width: 100%;
    padding: 12px;
    background: #5181b8;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    margin-bottom: 16px;
}

.check-button:hover {
    background: #4872a3;
}

.check-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Таймер ожидания */
.cooldown-timer {
    background: #fff3cd;
    border: 1px solid #ffa000;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 16px;
    text-align: center;
    color: #856404;
    font-weight: 500;
}

.timer-number {
    font-size: 24px;
    font-weight: 700;
    color: #e64646;
}

/* Результаты */
.result {
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    border-left: 4px solid;
    animation: slideIn 0.3s ease;
}

.result.success {
    background: #e8f5e8;
    border-color: #4bb34b;
    color: #2d5016;
}

.result.error {
    background: #ffeaea;
    border-color: #e64646;
    color: #820000;
}

.result.warning {
    background: #fff3cd;
    border-color: #ffa000;
    color: #856404;
}

.result.info {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

.result-title {
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 15px;
}

.result-text {
    margin-bottom: 12px;
    line-height: 1.5;
}

.database-results {
    margin-top: 12px;
}

.db-result {
    background: rgba(255,255,255,0.5);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
}

.db-result:last-child {
    margin-bottom: 0;
}

.db-result-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 13px;
}

.db-result-text {
    font-size: 12px;
    line-height: 1.4;
}

.risk-details {
    background: rgba(255,255,255,0.5);
    border-radius: 6px;
    padding: 10px;
    margin-top: 10px;
    font-size: 13px;
}

.risk-component {
    display: flex;
    justify-content: space-between;
    margin: 4px 0;
}

.risk-bar {
    width: 100%;
    height: 20px;
    background: #f0f2f5;
    border-radius: 10px;
    overflow: hidden;
    margin: 8px 0;
}

.risk-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.5s ease;
}

.risk-fill.high {
    background: linear-gradient(90deg, #ff6b6b, #ee5a52);
}

.risk-fill.medium {
    background: linear-gradient(90deg, #feca57, #ff9ff3);
}

.risk-fill.low {
    background: linear-gradient(90deg, #48dbfb, #0abde3);
}

/* Токены */
.tokens-display {
    margin-top: 10px;
    padding: 10px;
    background: rgba(255,255,255,0.5);
    border-radius: 6px;
}

.tokens-title {
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 12px;
}

.token {
    display: inline-block;
    padding: 2px 6px;
    margin: 2px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 500;
}

.token.high {
    background: #e64646;
    color: white;
}

.token.medium {
    background: #ffa000;
    color: white;
}

.token.low {
    background: #4bb34b;
    color: white;
}

.token.safe {
    background: #e7e8ec;
    color: #626d7a;
}

/* История */
.history-item {
    background: white;
    border: 1px solid #e7e8ec;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-domain {
    font-weight: 500;
    color: #2c2d2e;
}

.history-time {
    font-size: 12px;
    color: #626d7a;
}

.history-risk {
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.history-risk.high {
    background: #ffeaea;
    color: #e64646;
}

.history-risk.medium {
    background: #fff3cd;
    color: #856404;
}

.history-risk.low {
    background: #e8f5e8;
    color: #2d5016;
}

.history-databases {
    font-size: 10px;
    color: #626d7a;
    margin-top: 2px;
}

/* Загрузка */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #626d7a;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #5181b8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

/* Домашний блок */
.home-block {
    background: linear-gradient(135deg, #E6F3FF 0%, #B3D9FF 100%);
    color: #4A4A4A;
    padding: 16px;
    border-radius: 8px;
    margin: 16px 0;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(179, 217, 255, 0.3);
    border: 2px solid #87CEEB;
}

.home-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    color: #2F4F4F;
}

.home-text {
    font-size: 14px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    color: #556B2F;
}

.home-button {
    background: linear-gradient(135deg, #F0F8FF 0%, #E0F0FF 100%);
    border: 2px solid #87CEEB;
    color: #2F4F4F;
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.home-button:hover {
    background: linear-gradient(135deg, #D0E8FF 0%, #B0D8FF 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(135, 206, 235, 0.4);
}

/* Пустое состояние */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #626d7a;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

/* Подвал */
.footer {
    text-align: center;
    padding: 16px;
    color: #626d7a;
    font-size: 12px;
    border-top: 1px solid #e7e8ec;
    margin-top: 20px;
}

/* Анимации */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Адаптивность */
@media (max-width: 768px) {
    .content {
        padding: 12px;
    }
    
    .header {
        padding: 10px 12px;
    }
    
    .header-title {
        font-size: 14px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    
    .db-status {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .tabs {
        flex-direction: column;
        gap: 2px;
    }
    
    .tab {
        padding: 10px;
        font-size: 13px;
    }
    
    .input-field {
        font-size: 14px;
    }
    
    .check-button {
        font-size: 14px;
    }
}