/* API Keys Page */
.api-keys-page {
    min-height: 100vh;
    background: #0a0a0a;
    color: #e5e5e5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.api-keys-header {
    padding: 20px 32px;
    border-bottom: 1px solid #222;
    background: #0a0a0a;
    position: sticky;
    top: 0;
    z-index: 10;
}

.api-keys-header .back-btn {
    background: none;
    border: none;
    color: #e5e5e5;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.api-keys-header .back-btn:hover {
    background: #1a1a1a;
}

.header-title-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.api-keys-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0;
}

.pro-badge {
    display: inline-block;
    padding: 4px 12px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #000;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.subtitle {
    font-size: 14px;
    color: #71717a;
    margin: 0;
}

.api-keys-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 20px;
}

/* API Documentation Card */
.api-docs-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
}

.api-docs-card h2 {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 8px 0;
}

.api-docs-card > p {
    font-size: 14px;
    color: #71717a;
    margin: 0 0 24px 0;
}

.api-endpoints {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 24px;
}

.endpoint {
    background: #1a1a1a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 16px;
}

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

.method {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.method.post {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.method.get {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.endpoint-header code {
    font-size: 14px;
    color: #667eea;
    font-family: 'Monaco', 'Courier New', monospace;
}

.endpoint > p {
    font-size: 13px;
    color: #a1a1aa;
    margin: 0 0 12px 0;
}

.code-block {
    background: #0a0a0a;
    border: 1px solid #222;
    border-radius: 6px;
    padding: 12px;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    font-size: 12px;
    color: #e5e5e5;
    font-family: 'Monaco', 'Courier New', monospace;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.auth-methods {
    background: #1a1a1a;
    border: 1px solid #222;
    border-radius: 8px;
    padding: 16px;
}

.auth-methods h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 12px 0;
}

.auth-method {
    padding: 12px 0;
    border-bottom: 1px solid #222;
    font-size: 13px;
}

.auth-method:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.auth-method strong {
    display: block;
    color: #fff;
    margin-bottom: 6px;
}

.auth-method code {
    display: block;
    background: #0a0a0a;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #667eea;
    font-family: 'Monaco', 'Courier New', monospace;
    margin-top: 4px;
}

/* User ID Card */
.user-id-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.user-id-display {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.user-id-display code {
    flex: 1;
    background: #1a1a1a;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    color: #667eea;
    font-family: 'Monaco', 'Courier New', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Create Key Card */
.create-key-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.card-content {
    flex: 1;
}

.card-content h2 {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 0 0 4px 0;
}

.card-content p {
    font-size: 14px;
    color: #71717a;
    margin: 0;
}

.create-key-btn {
    background: #667eea;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.create-key-btn:hover {
    background: #5568d3;
}

/* Keys List */
.keys-list {
    margin-top: 32px;
}

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.list-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.key-count {
    font-size: 14px;
    color: #71717a;
}

.keys-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* Key Card */
.key-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.2s;
}

.key-card:hover {
    border-color: #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.key-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.key-icon {
    font-size: 24px;
}

.key-menu-btn {
    background: none;
    border: none;
    color: #71717a;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all 0.2s;
}

.key-menu-btn:hover {
    background: #1a1a1a;
    color: #e5e5e5;
}

.key-name {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
}

.key-value {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.masked-key {
    flex: 1;
    background: #1a1a1a;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #667eea;
    font-family: 'Monaco', 'Courier New', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.copy-btn {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #71717a;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background: #222;
    border-color: #444;
    color: #e5e5e5;
}

.key-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    padding-top: 12px;
    border-top: 1px solid #222;
}

.stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #71717a;
}

.stat svg {
    flex-shrink: 0;
}

.key-actions {
    display: flex;
    gap: 8px;
}

.key-action-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #333;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.key-action-btn.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.key-action-btn.delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Empty State */
.empty-keys {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.empty-keys svg {
    stroke: #333;
    margin-bottom: 20px;
}

.empty-keys h3 {
    font-size: 18px;
    font-weight: 500;
    color: #a1a1aa;
    margin: 0 0 8px 0;
}

.empty-keys p {
    font-size: 14px;
    color: #71717a;
    margin: 0;
}

/* Loading State */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #222;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Error State */
.error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #ef4444;
}

/* Key Modal */
.key-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.key-modal {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 12px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

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

.key-modal h2 {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px 0;
}

.key-modal > p {
    font-size: 14px;
    color: #71717a;
    margin: 0 0 24px 0;
}

.key-display {
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.key-display code {
    flex: 1;
    font-size: 13px;
    color: #667eea;
    font-family: 'Monaco', 'Courier New', monospace;
    word-break: break-all;
}

.copy-modal-btn {
    background: #667eea;
    border: none;
    color: #fff;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.copy-modal-btn:hover {
    background: #5568d3;
}

.modal-close-btn {
    width: 100%;
    padding: 12px;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: #2a2a2f;
    border-color: #52525b;
}

/* Light Theme */
[data-theme="light"] .api-keys-page {
    background: #f5f5f5;
    color: #1a1a1a;
}

[data-theme="light"] .api-keys-header {
    background: #fff;
    border-bottom-color: #e5e5e5;
}

[data-theme="light"] .api-keys-header h1 {
    color: #1a1a1a;
}

[data-theme="light"] .api-keys-header .back-btn {
    color: #1a1a1a;
}

[data-theme="light"] .api-keys-header .back-btn:hover {
    background: #f5f5f5;
}

[data-theme="light"] .api-docs-card,
[data-theme="light"] .user-id-card,
[data-theme="light"] .create-key-card,
[data-theme="light"] .key-card {
    background: #fff;
    border-color: #e5e5e5;
}

[data-theme="light"] .user-id-display code {
    background: #f5f5f5;
}

[data-theme="light"] .api-docs-card h2,
[data-theme="light"] .card-content h2,
[data-theme="light"] .list-header h3 {
    color: #1a1a1a;
}

[data-theme="light"] .endpoint,
[data-theme="light"] .auth-methods {
    background: #f5f5f5;
    border-color: #e5e5e5;
}

[data-theme="light"] .code-block,
[data-theme="light"] .auth-method code {
    background: #fff;
    border-color: #e5e5e5;
}

[data-theme="light"] .code-block pre {
    color: #1a1a1a;
}

[data-theme="light"] .masked-key {
    background: #f5f5f5;
}

[data-theme="light"] .copy-btn {
    background: #f5f5f5;
    border-color: #d4d4d8;
}

[data-theme="light"] .copy-btn:hover {
    background: #e5e5e5;
}

[data-theme="light"] .key-stats {
    border-top-color: #e5e5e5;
}

[data-theme="light"] .key-card:hover {
    border-color: #d4d4d8;
}

[data-theme="light"] .key-modal {
    background: #fff;
    border-color: #e5e5e5;
}

[data-theme="light"] .key-modal h2 {
    color: #1a1a1a;
}

[data-theme="light"] .key-display {
    background: #f4f4f5;
    border-color: #e5e5e5;
}

[data-theme="light"] .modal-close-btn {
    background: #f4f4f5;
    border-color: #e5e5e5;
    color: #1a1a1a;
}

[data-theme="light"] .modal-close-btn:hover {
    background: #fff;
    border-color: #d4d4d8;
}

[data-theme="light"] .key-name {
    color: #1a1a1a;
}

/* Responsive */
@media (max-width: 768px) {
    .api-keys-content {
        padding: 20px 16px;
    }

    .create-key-card {
        flex-direction: column;
        align-items: stretch;
    }

    .create-key-btn {
        width: 100%;
        justify-content: center;
    }

    .keys-grid {
        grid-template-columns: 1fr;
    }

    .code-block pre {
        font-size: 11px;
    }
}
