/**
 * ═══════════════════════════════════════════════════════════════════════════
 * LAYER 72: API INTEGRATION - STYLING
 * ═══════════════════════════════════════════════════════════════════════════
 */

/* ========== API LOADING STATE ========== */
.api-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.api-loading .spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--color-gray-200, #e5e7eb);
    border-top-color: var(--color-primary, #667eea);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

.api-loading p {
    color: var(--color-gray-500, #6b7280);
    font-size: 0.875rem;
}

/* ========== API ERROR STATE ========== */
.api-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: #fee2e2;
    border: 1px solid #fca5a5;
    border-radius: 12px;
    text-align: center;
}

.api-error .error-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.api-error p {
    color: #991b1b;
    margin: 0;
}

/* ========== API LIST ========== */
.api-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.api-list-item {
    padding: 1rem;
    border-bottom: 1px solid var(--color-gray-200, #e5e7eb);
    transition: background 0.3s ease;
}

.api-list-item:hover {
    background: var(--color-light-secondary, #f9fafb);
}

.api-list-item:last-child {
    border-bottom: none;
}

/* ========== API GRID ========== */
.api-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 1rem 0;
}

.api-grid-item {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.api-grid-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

/* ========== API TABLE ========== */
.api-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.api-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.api-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.api-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--color-gray-200, #e5e7eb);
}

.api-table tbody tr:hover {
    background: var(--color-light-secondary, #f9fafb);
}

.api-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========== API CARDS ========== */
.api-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin: 1rem 0;
}

.api-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.api-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.api-card-header {
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.api-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.api-card-body {
    padding: 1.5rem;
}

.api-card-footer {
    padding: 1rem 1.5rem;
    background: var(--color-light-secondary, #f9fafb);
    border-top: 1px solid var(--color-gray-200, #e5e7eb);
}

/* ========== API DATA DISPLAY ========== */
.api-data {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 1.5rem;
    border-radius: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
    overflow-x: auto;
    max-height: 500px;
    overflow-y: auto;
}

.api-field {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-gray-200, #e5e7eb);
}

.api-field:last-child {
    border-bottom: none;
}

.api-field strong {
    color: var(--color-primary, #667eea);
    margin-right: 0.5rem;
}

/* ========== API CONTAINER ========== */
.api-container {
    background: white;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin: 2rem 0;
}

.api-container-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--color-gray-200, #e5e7eb);
}

.api-container-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.api-container-actions {
    display: flex;
    gap: 0.5rem;
}

/* ========== API STATS ========== */
.api-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.api-stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.api-stat-value {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.api-stat-label {
    font-size: 0.875rem;
    color: var(--color-gray-500, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========== API SYNC INDICATOR ========== */
.api-sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 20px;
    font-size: 0.875rem;
    color: #059669;
}

.api-sync-indicator.syncing {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #2563eb;
}

.api-sync-indicator.error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #dc2626;
}

.api-sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ========== API BADGE ========== */
.api-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.api-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.api-badge.error {
    background: #fee2e2;
    color: #991b1b;
}

.api-badge.warning {
    background: #fef3c7;
    color: #92400e;
}

.api-badge.info {
    background: #dbeafe;
    color: #1e40af;
}

/* ========== API TIMELINE ========== */
.api-timeline {
    position: relative;
    padding-left: 2rem;
}

.api-timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--color-gray-200, #e5e7eb);
}

.api-timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.api-timeline-item::before {
    content: '';
    position: absolute;
    left: -2.5rem;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-primary, #667eea);
    border: 2px solid white;
    box-shadow: 0 0 0 2px var(--color-gray-200, #e5e7eb);
}

.api-timeline-time {
    font-size: 0.75rem;
    color: var(--color-gray-500, #6b7280);
    margin-bottom: 0.5rem;
}

.api-timeline-content {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .api-grid {
        grid-template-columns: 1fr;
    }

    .api-cards {
        grid-template-columns: 1fr;
    }

    .api-stats {
        grid-template-columns: 1fr;
    }

    .api-table {
        font-size: 0.875rem;
    }

    .api-table th,
    .api-table td {
        padding: 0.75rem 0.5rem;
    }

    .api-container {
        padding: 1rem;
    }

    .api-container-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* ========== ANIMATIONS ========== */
.api-data-loaded {
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========== API FILTERS ========== */
.api-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--color-light-secondary, #f9fafb);
    border-radius: 12px;
}

.api-filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.api-filter-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-gray-700, #374151);
}

.api-filter-select {
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-gray-200, #e5e7eb);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.875rem;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.api-filter-select:focus {
    outline: none;
    border-color: var(--color-primary, #667eea);
}

/* ========== API PAGINATION ========== */
.api-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}

.api-pagination-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--color-gray-200, #e5e7eb);
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.api-pagination-btn:hover:not(:disabled) {
    border-color: var(--color-primary, #667eea);
    background: var(--color-light-secondary, #f9fafb);
}

.api-pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.api-pagination-btn.active {
    background: var(--color-primary, #667eea);
    color: white;
    border-color: var(--color-primary, #667eea);
}