/**
 * API Panel Styles
 *
 * Styles for:
 * - Curl example panels
 * - API key generation forms
 * - Rate limit tables
 * - API dashboard
 */

/* =============================================================================
   API Panel Card
   ============================================================================= */

.api-panel {
    margin-top: 2rem;
}

.api-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.api-section:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.api-section h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary, #1f2937);
}

/* =============================================================================
   Curl Examples
   ============================================================================= */

.curl-example {
    background: var(--bg-secondary, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.5rem;
    overflow: hidden;
}

.curl-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary, #f3f4f6);
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.curl-method {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    background: var(--color-success, #10b981);
    color: white;
    border-radius: 0.25rem;
}

.curl-url {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-secondary, #6b7280);
}

.curl-code {
    margin: 0;
    padding: 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    background: var(--bg-secondary, #f9fafb);
    color: var(--text-primary, #1f2937);
}

/* =============================================================================
   Copy Button
   ============================================================================= */

.btn-copy {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: var(--bg-primary, white);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-copy:hover {
    background: var(--bg-secondary, #f9fafb);
    border-color: var(--border-color-hover, #d1d5db);
}

.btn-copy.copied {
    background: var(--color-success, #10b981);
    border-color: var(--color-success, #10b981);
    color: white;
}

.copy-icon {
    width: 16px;
    height: 16px;
}

svg.copy-icon {
    stroke: var(--text-secondary, #6b7280);
}

.btn-copy:hover svg.copy-icon {
    stroke: var(--text-primary, #1f2937);
}

.btn-copy.copied svg.copy-icon {
    stroke: white;
}

/* =============================================================================
   Rate Limit Table
   ============================================================================= */

.rate-limit-table,
.endpoints-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.rate-limit-table th,
.rate-limit-table td,
.endpoints-table th,
.endpoints-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.rate-limit-table th,
.endpoints-table th {
    font-weight: 600;
    background: var(--bg-secondary, #f9fafb);
    color: var(--text-secondary, #6b7280);
}

.rate-limit-table tbody tr:hover,
.endpoints-table tbody tr:hover {
    background: var(--bg-secondary, #f9fafb);
}

/* =============================================================================
   API Key Form
   ============================================================================= */

.api-key-form {
    max-width: 30rem;
}

.api-key-form .form-row {
    margin-bottom: 1rem;
}

.api-key-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary, #1f2937);
}

.api-key-form input[type="email"],
.api-key-form input[type="text"] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.375rem;
    background: var(--bg-primary, white);
    color: var(--text-primary, #1f2937);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.api-key-form input:focus {
    outline: none;
    border-color: var(--color-primary, #3b82f6);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.api-key-form small {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-tertiary, #9ca3af);
}

.api-key-form .btn-primary {
    display: inline-flex;
    align-items: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    background: var(--color-primary, #3b82f6);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.api-key-form .btn-primary:hover {
    background: var(--color-primary-hover, #2563eb);
}

.api-key-form .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =============================================================================
   API Key Result
   ============================================================================= */

.api-key-result {
    margin-top: 1.5rem;
    padding: 1rem;
    background: var(--bg-success-light, #ecfdf5);
    border: 1px solid var(--color-success, #10b981);
    border-radius: 0.5rem;
}

.api-key-warning {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg-warning-light, #fef3c7);
    border: 1px solid var(--color-warning, #f59e0b);
    border-radius: 0.375rem;
    color: var(--color-warning-dark, #92400e);
    font-size: 0.875rem;
}

.api-key-display {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.api-key-display code {
    flex: 1;
    padding: 0.75rem 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.875rem;
    background: var(--bg-primary, white);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.375rem;
    word-break: break-all;
}

.api-key-info {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary, #6b7280);
}

/* =============================================================================
   API Key Error
   ============================================================================= */

.api-key-error {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-error-light, #fef2f2);
    border: 1px solid var(--color-error, #ef4444);
    border-radius: 0.375rem;
    color: var(--color-error, #ef4444);
    font-size: 0.875rem;
}

/* =============================================================================
   JSON Example
   ============================================================================= */

.json-example {
    margin: 0;
    padding: 1rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre;
    overflow-x: auto;
    background: var(--bg-secondary, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.5rem;
    color: var(--text-primary, #1f2937);
}

/* =============================================================================
   Dashboard Stats Grid
   ============================================================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-item {
    padding: 1rem;
    background: var(--bg-secondary, #f9fafb);
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 0.5rem;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary, #3b82f6);
}

.stat-label {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* =============================================================================
   Data Table
   ============================================================================= */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.data-table th {
    font-weight: 600;
    background: var(--bg-secondary, #f9fafb);
    color: var(--text-secondary, #6b7280);
}

.data-table tbody tr:hover {
    background: var(--bg-secondary, #f9fafb);
}

/* =============================================================================
   Method Badges
   ============================================================================= */

.method-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 0.25rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.method-badge.get {
    background: var(--color-success, #10b981);
    color: white;
}

.method-badge.post {
    background: var(--color-primary, #3b82f6);
    color: white;
}

.method-badge.delete {
    background: var(--color-error, #ef4444);
    color: white;
}

/* =============================================================================
   Staff Only Badge
   ============================================================================= */

.badge.staff-only {
    background: #800020;  /* Maroon */
    color: white;
}

/* =============================================================================
   Buttons
   ============================================================================= */

.btn-danger {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    background: var(--color-error, #ef4444);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-danger:hover {
    background: var(--color-error-hover, #dc2626);
}

.btn-danger.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* =============================================================================
   Responsive Adjustments
   ============================================================================= */

@media (max-width: 640px) {
    .curl-header {
        flex-wrap: wrap;
    }

    .curl-url {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .api-key-display {
        flex-direction: column;
        align-items: stretch;
    }

    .api-key-display code {
        text-align: center;
    }

    .api-key-info {
        flex-direction: column;
        gap: 0.5rem;
    }

    .data-table {
        font-size: 0.8125rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem 0.75rem;
    }
}
