/* ==============================================================================
   AMETIST IOT PLATFORM — help_api.css
   API Documentation Content & Workflow
   Cosmic Glassmorphism Theme (ametist-tech.ru Style)
   ============================================================================== */

/* ===== СТИЛИ ДЛЯ СТРАНИЦЫ API ===== */
.api-container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 30px 20px 80px;
    position: relative;
    z-index: 10;
}

.api-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.api-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(124, 58, 237, 0.15) !important;
    border: 1px solid rgba(168, 85, 247, 0.4) !important;
    border-radius: 9999px;
    padding: 6px 18px;
    font-size: 0.8rem;
    font-weight: 700;
    color: #d8b4fe !important;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 16px;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.25);
}

.api-title {
    font-size: 2.4rem;
    font-weight: 800;
    color: #ffffff !important;
    background: linear-gradient(135deg, #c084fc 0%, #7c3aed 50%, #38bdf8 100%) !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    margin-bottom: 12px;
    letter-spacing: -0.01em;
}

.api-subtitle {
    color: #94a3b8 !important;
    font-size: 1.05rem;
    max-width: 720px;
    margin: 0 auto 1.5rem;
    line-height: 1.6;
}

/* Tabs Bar */
.api-tabs-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 20px auto 35px;
    max-width: 1100px;
}

.api-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(14, 10, 36, 0.8) !important;
    border: 1px solid rgba(124, 58, 237, 0.28) !important;
    color: #cbd5e1 !important;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.25s ease;
}

.api-tab-btn:hover {
    background: rgba(124, 58, 237, 0.25) !important;
    border-color: #a855f7 !important;
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.3);
}

.api-tab-btn.active {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.5) 0%, rgba(168, 85, 247, 0.4) 100%) !important;
    border-color: #c084fc !important;
    color: #ffffff !important;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}

/* API Card / Section */
.api-section {
    background: rgba(14, 10, 36, 0.92) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border-radius: 20px !important;
    padding: 32px !important;
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(124, 58, 237, 0.15) !important;
    border: 1px solid rgba(124, 58, 237, 0.3) !important;
    margin-bottom: 2.2rem !important;
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.api-section:hover {
    border-color: rgba(168, 85, 247, 0.5) !important;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.7), 0 0 35px rgba(124, 58, 237, 0.25) !important;
}

.api-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px !important;
    background: linear-gradient(90deg, #7c3aed, #a855f7, #38bdf8) !important;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ffffff !important;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(124, 58, 237, 0.22) !important;
}

.section-description {
    color: #cbd5e1 !important;
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 1.8rem;
}

/* Method Badge */
.method-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-family: monospace;
}

.method-badge.post {
    background: rgba(56, 189, 248, 0.2) !important;
    color: #38bdf8 !important;
    border: 1px solid rgba(56, 189, 248, 0.45) !important;
}

.method-badge.get {
    background: rgba(52, 211, 153, 0.2) !important;
    color: #34d399 !important;
    border: 1px solid rgba(52, 211, 153, 0.45) !important;
}

.endpoint-url {
    font-family: 'SFMono-Regular', Consolas, Monaco, monospace;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
}

/* Таблица устройств */
.devices-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(8, 5, 24, 0.6) !important;
    border-radius: 14px;
    overflow: hidden;
    margin: 1.5rem 0;
    border: 1px solid rgba(124, 58, 237, 0.25) !important;
}

.devices-table th {
    background: rgba(124, 58, 237, 0.16) !important;
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    color: #c084fc !important;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid rgba(124, 58, 237, 0.25) !important;
}

.devices-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #f1f5f9 !important;
    font-size: 0.9rem;
}

.devices-table tr:last-child td {
    border-bottom: none !important;
}

.devices-table tr:hover {
    background: rgba(124, 58, 237, 0.1) !important;
}

/* Бейджи типов устройств */
.device-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(124, 58, 237, 0.22) !important;
    color: #d8b4fe !important;
    border: 1px solid rgba(168, 85, 247, 0.45) !important;
    font-family: monospace;
    letter-spacing: 0.05em;
}

.device-description {
    color: #94a3b8 !important;
    font-size: 0.9rem;
}

/* Иконки устройств */
.device-icon {
    font-size: 1.25rem;
    margin-right: 8px;
    vertical-align: middle;
}

/* Маркированный текст */
.marked-text {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.35), rgba(168, 85, 247, 0.25)) !important;
    color: #ffffff !important;
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-family: monospace;
    border: 1px solid rgba(168, 85, 247, 0.4) !important;
}

/* Примеры кода */
.code-example {
    background: #080518 !important;
    border: 1px solid rgba(124, 58, 237, 0.35) !important;
    border-radius: 12px;
    padding: 22px;
    margin: 1.5rem 0;
    font-family: 'SFMono-Regular', Consolas, Monaco, monospace !important;
    color: #38bdf8 !important;
    font-size: 0.9rem;
    line-height: 1.65;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7) !important;
    overflow-x: auto;
}

.code-comment {
    color: #64748b !important;
    font-style: italic;
}

/* Сетка функций */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 2rem 0;
}

.feature-card {
    background: rgba(14, 10, 36, 0.75) !important;
    border-radius: 16px;
    padding: 22px;
    border: 1px solid rgba(124, 58, 237, 0.22) !important;
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: rgba(124, 58, 237, 0.12) !important;
    border-color: rgba(168, 85, 247, 0.5) !important;
    transform: translateY(-4px);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.6);
}

.feature-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    display: inline-block;
    filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.5));
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff !important;
    margin-bottom: 8px;
}

.feature-description {
    color: #94a3b8 !important;
    font-size: 0.88rem;
    line-height: 1.6;
}

/* Шаги воркфлоу */
.api-workflow {
    margin: 2rem 0;
}

.workflow-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 2rem 0;
}

.workflow-step {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 20px 24px;
    background: rgba(14, 10, 36, 0.75) !important;
    border-radius: 16px;
    border: 1px solid rgba(124, 58, 237, 0.22) !important;
    transition: all 0.3s ease;
}

.workflow-step:hover {
    background: rgba(124, 58, 237, 0.12) !important;
    border-color: rgba(168, 85, 247, 0.45) !important;
    transform: translateX(8px);
}

.step-number {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%) !important;
    color: white !important;
    width: 42px;
    height: 42px;
    border-radius: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.15rem;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.45) !important;
    border: 1px solid rgba(168, 85, 247, 0.5) !important;
}

.step-content {
    flex: 1;
}

.step-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff !important;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-description {
    color: #cbd5e1 !important;
    font-size: 0.92rem;
    line-height: 1.6;
}

.api-image {
    text-align: center;
    margin: 2rem 0;
}

.api-image img {
    max-width: 100%;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    border: 1px solid rgba(124, 58, 237, 0.3) !important;
}

/* Warnings and Notifications */
.warning-box {
    background: rgba(245, 158, 11, 0.1) !important;
    border: 1px solid rgba(245, 158, 11, 0.4) !important;
    border-radius: 16px !important;
    padding: 22px;
    margin: 2rem 0;
}

.warning-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.warning-icon {
    font-size: 1.4rem;
}

.warning-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fde047 !important;
}

.warning-text {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.92rem;
    line-height: 1.6;
}

.protocol-info {
    background: rgba(124, 58, 237, 0.1) !important;
    border: 1px solid rgba(168, 85, 247, 0.35) !important;
    border-radius: 16px !important;
    padding: 22px;
    margin: 2rem 0;
}

.protocol-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.protocol-icon {
    font-size: 1.4rem;
}

.protocol-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #c084fc !important;
}

.protocol-text {
    color: rgba(255, 255, 255, 0.8) !important;
    font-size: 0.92rem;
    line-height: 1.6;
}

/* Workflow Table */
.api-workflow-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(8, 5, 24, 0.6) !important;
    border-radius: 14px;
    overflow: hidden;
    margin: 2rem 0;
    border: 1px solid rgba(124, 58, 237, 0.25) !important;
}

.api-workflow-table th {
    background: rgba(124, 58, 237, 0.16) !important;
    padding: 16px 20px;
    text-align: left;
    font-weight: 700;
    color: #c084fc !important;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(124, 58, 237, 0.25) !important;
}

.api-workflow-table td {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
    color: #f1f5f9 !important;
    font-size: 0.9rem;
}

.api-workflow-table tr:last-child td {
    border-bottom: none !important;
}

.api-workflow-table tr:hover {
    background: rgba(124, 58, 237, 0.1) !important;
}

.step-action {
    font-weight: 700;
    color: #38bdf8 !important;
}

.step-result {
    color: #cbd5e1 !important;
}

/* Utilities */
.text-center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-4 {
    margin-top: 2rem;
}

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

.api-section {
    animation: slideIn 0.35s ease-out;
}

@media (max-width: 768px) {
    .api-container {
        padding: 20px 14px;
    }
    
    .api-title {
        font-size: 1.8rem;
    }
    
    .api-section {
        padding: 20px 16px !important;
    }
    
    .workflow-step {
        flex-direction: column;
        gap: 12px;
    }
    
    .step-number {
        align-self: flex-start;
    }
    
    .devices-table, .api-workflow-table {
        font-size: 0.82rem;
    }
    
    .devices-table th, .devices-table td,
    .api-workflow-table th, .api-workflow-table td {
        padding: 10px 12px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}
