﻿/* SaleBot AI Service - Styles */

/* Reset & Base */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f5f5f5;
    padding: 20px;
    line-height: 1.5;
}

.container { max-width: 1200px; margin: 0 auto; }

/* Typography */
h1, h2, h3 { margin-bottom: 20px; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; margin-top: 20px; }

/* Form Elements */
input, textarea, select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #0066cc;
}

label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
    font-size: 14px;
    cursor: pointer;
}

/* Labels РІ РёРЅС‚РµРіСЂР°С†РёСЏС… - inline РґР»СЏ СЂР°Р±РѕС‚С‹ СЃ checkbox */
#integrations-tab .integration-header-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0;
    cursor: pointer;
}

textarea { resize: vertical; min-height: 80px; }

/* Buttons */
button {
    background: #0066cc;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

button:hover { background: #0052a3; }

.btn-admin { background: #673ab7; }
.btn-admin:hover { background: #5e35b1; }

.btn-danger { background: #dc3545; }
.btn-danger:hover { background: #c82333; }

.btn-success { background: #4caf50; }
.btn-success:hover { background: #43a047; }

.btn-purple { background: #673ab7; }
.btn-purple:hover { background: #5e35b1; }

.btn-cancel { background: #666; }
.btn-cancel:hover { background: #555; }

.btn-small {
    font-size: 11px;
    padding: 4px 10px;
}

/* Layout */
.header-buttons {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Project Cards */
.project {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    background: #fafafa;
}

.project strong { font-size: 16px; }

.api-keys {
    background: #f0f0f0;
    padding: 10px;
    border-radius: 6px;
    font-family: monospace;
    margin: 10px 0;
    font-size: 13px;
    word-break: break-all;
}

/* Status Badges */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-ready { background: #4caf50; color: white; }
.status-pending { background: #ff9800; color: white; }

/* Platform Badges */
.platform-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-right: 4px;
}

.platform-on { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.platform-off { background: #f5f5f5; color: #9e9e9e; border: 1px solid #e0e0e0; }

/* Password Toggle */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input { flex: 1; padding-right: 40px; }

.toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover { color: #333; background: none; }

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

.switch input:checked + .slider { background-color: #4caf50; }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* Info Boxes */
.info-box {
    background: #e3f2fd;
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 15px;
}

.info-box.success { background: #e8f5e9; }
.info-box.warning { background: #fff3cd; }
.info-box.error { background: #ffebee; }

.hint {
    color: #666;
    display: block;
    margin: -10px 0 15px 0;
    font-size: 13px;
}

.hint-box {
    background: #e3f2fd;
    padding: 10px;
    border-radius: 6px;
    margin-top: 8px;
    font-size: 13px;
    color: #1565c0;
}

/* Integration Cards */
.integration-card {
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    background: white;
}

.integration-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.integration-settings { margin-top: 10px; }

/* РЎС‚РёР»Рё РґР»СЏ РІРєР»Р°РґРѕРє РёРЅС‚РµРіСЂР°С†РёР№ РІ РјРѕРґР°Р»СЊРЅРѕРј РѕРєРЅРµ РїСЂРѕРµРєС‚Р° */
#integrations-tab .integration-block {
    margin-bottom: 20px;
    padding: 15px;
    background: #e3f2fd;
    border-radius: 8px;
}

#integrations-tab .integration-header-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    margin-bottom: 10px;
}

#integrations-tab .integration-header-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    flex-shrink: 0;
}

#integrations-tab .integration-header-row label {
    font-weight: bold;
    font-size: 16px;
    margin: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#integrations-tab .integration-icon {
    font-size: 20px;
}

#integrations-tab .integration-settings {
    margin-top: 10px;
}

#integrations-tab .integration-settings label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
    font-size: 14px;
}

#integrations-tab .integration-settings input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

#integrations-tab .integration-webhook {
    color: #666;
    font-size: 13px;
    margin-top: 5px;
    display: block;
}

/* РњРѕРґР°Р»СЊРЅРѕРµ РѕРєРЅРѕ РїСЂРёСЃРѕРµРґРёРЅРµРЅРёСЏ Рє СЂРѕСѓС‚РµСЂСѓ */
#join-router-modal .modal-content {
    max-width: 600px;
}

#join-router-modal select,
#join-router-modal input[type="number"],
#join-router-modal textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

#join-router-modal textarea {
    resize: vertical;
    min-height: 80px;
}

/* РђРґРјРёРЅ-РїР°РЅРµР»СЊ РЅР°РІРёРіР°С†РёСЏ */
#admin-modal button {
    margin-right: 5px;
    margin-bottom: 5px;
}

#admin-modal .stat-card {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

#admin-modal table {
    font-size: 13px;
}

#admin-modal table th,
#admin-modal table td {
    padding: 8px;
}

/* File Input */
.file-input {
    border: 2px dashed #ddd;
    padding: 30px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-input:hover { border-color: #0066cc; }

/* Modals */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
}

.modal-content {
    position: relative !important;
    margin: 30px auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1500;
}

.modal-medium { max-width: 600px; }
.modal-large { max-width: 800px; }

/* РљРЅРѕРїРєРё РІ РјРѕРґР°Р»СЊРЅС‹С… РѕРєРЅР°С… */
.modal-content button {
    min-width: 100px;
}

.modal-overlay .btn-cancel { background: #666; }
.modal-overlay .btn-cancel:hover { background: #555; }
.modal-overlay .btn-success { background: #4caf50; }
.modal-overlay .btn-success:hover { background: #43a047; }
.modal-overlay .btn-danger { background: #dc3545; }
.modal-overlay .btn-danger:hover { background: #c82333; }
.modal-overlay .btn-purple { background: #673ab7; }
.modal-overlay .btn-purple:hover { background: #5e35b1; }

/* Document List */
.doc-item {
    margin: 5px 0;
    padding: 8px;
    background: #f5f5f5;
    border-radius: 4px;
    border-left: 4px solid #ccc;
}

.doc-item.completed { border-left-color: #4caf50; }
.doc-item.processing { border-left-color: #2196f3; }
.doc-item.failed { border-left-color: #f44336; }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th, td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

th { background: #f5f5f5; font-weight: 600; }

/* Code */
code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

pre {
    background: #333;
    color: #f8f8f2;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 13px;
}

pre code {
    background: transparent;
    color: #f8f8f2;
    padding: 0;
}

/* Grid */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

/* Stats Cards */
.stat-card {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-card .value {
    font-size: 32px;
    font-weight: bold;
}

.stat-card .label {
    color: #666;
    font-size: 14px;
}

/* Responsive */
@media (max-width: 768px) {
    body { padding: 10px; }
    .card { padding: 16px; }
    .modal-content { padding: 20px; margin: 10px auto; }
    .button-group { flex-direction: column; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    h1 { font-size: 24px; }
    h2 { font-size: 20px; }
    .app-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .header-buttons { flex-direction: column; }
    .header-buttons button { width: 100%; justify-content: center; }

    h1 { font-size: 22px !important; }

    .container > div:first-child {
        flex-direction: column !important;
        gap: 8px !important;
    }
    .container > div:first-child button {
        width: 100% !important;
        padding: 10px !important;
        font-size: 14px !important;
    }

    .card { padding: 12px !important; }
    .card h2 { font-size: 18px !important; }

    input, textarea, select { font-size: 14px !important; }
    label { font-size: 14px !important; }

    button {
        font-size: 13px !important;
        padding: 8px 12px !important;
        width: 100%;
        margin-bottom: 8px;
    }
    .button-group {
        flex-direction: column !important;
    }
    .button-group button {
        width: 100% !important;
    }

    .project { padding: 12px !important; }
    .project strong { font-size: 15px !important; }
    .api-keys { font-size: 11px !important; }

    table { font-size: 12px !important; }
    th, td { padding: 6px !important; }

    .modal-content {
        width: 95% !important;
        padding: 15px !important;
        margin: 5px auto !important;
        margin-right: 5px !important;
    }
    .modal-medium, .modal-large {
        max-width: 100% !important;
    }
    .modal-content h2 { font-size: 18px !important; }
    .modal-content h3 { font-size: 16px !important; }

    .container { padding: 15px !important; }
    h1 { font-size: 24px !important; }
    h2 { font-size: 20px !important; }
    h3 { font-size: 18px !important; }
    p, li { font-size: 15px !important; }

    .nav-buttons { flex-direction: column; }
    .nav-btn { width: 100%; text-align: center; }

    .table-responsive {
        overflow-x: auto;
        width: 100%;
    }
    
    /* РљСЂРµСЃС‚РёРє РІ РїСЂР°РІРѕРј СѓРіР»Сѓ РЅР° РјРѕР±РёР»СЊРЅС‹С… */
    .modal-close-btn {
        top: 8px !important;
        right: 10px !important;
        font-size: 24px !important;
    }
}

/* РђРґР°РїС‚РёРІРЅР°СЏ С€Р°РїРєР° */
.container > div:first-child {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.container > div:first-child button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    background: #0066cc;
    color: white;
    transition: background 0.3s;
}

.container > div:first-child button:hover {
    background: #0052a3;
}

#admin-panel-btn {
    background: #673ab7 !important;
}

/* Modal close buttons */
.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    background: none !important;
    border: none !important;
    cursor: pointer;
    color: #666;
    padding: 5px 10px;
    border-radius: 4px;
    z-index: 2000;
    line-height: 1;
    display: block !important;
    min-width: unset !important;
    width: auto !important;
}

.modal-close-btn:hover {
    background: #f0f0f0 !important;
    color: #333;
}

/* Mobile: instant tap response — no 300ms delay */
@media (max-width: 768px) {
    button, .action-btn {
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
    }
}

/* Mobile: instant tap response вЂ” no 300ms delay */
@media (max-width: 768px) {
