/* Swagger UI Dark Theme for e-automate API
 * Matches the home page dark theme styling
 */

:root {
    --ea-primary: #3b82f6;
    --ea-primary-light: #60a5fa;
    --ea-primary-dark: #2563eb;
    --ea-accent: #10b981;
    --ea-accent-dark: #059669;
    --ea-bg: #0f172a;
    --ea-bg-card: #1e293b;
    --ea-bg-card-hover: #334155;
    --ea-text: #f1f5f9;
    --ea-text-muted: #94a3b8;
    --ea-text-dim: #64748b;
    --ea-border: #334155;
    --ea-shadow: 0 4px 20px rgba(0,0,0,0.3);
    --ea-radius: 16px;
    --ea-radius-sm: 8px;
}

/* ============================================
   Navigation Bar
   ============================================ */

.api-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--ea-bg);
    border-bottom: 1px solid var(--ea-border);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.api-nav .nav-home {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ea-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.api-nav .nav-home:hover {
    color: var(--ea-primary-light);
}

.api-nav .nav-home span {
    background: linear-gradient(135deg, var(--ea-primary), var(--ea-accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.api-nav .nav-links {
    display: flex;
    gap: 8px;
}

.api-nav .nav-link {
    font-size: 0.875rem;
    color: var(--ea-text-muted);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--ea-radius-sm);
    transition: all 0.15s ease;
}

.api-nav .nav-link:hover {
    background: var(--ea-bg-card);
    color: var(--ea-text);
}

.api-nav .nav-link.active {
    background: linear-gradient(135deg, var(--ea-primary), var(--ea-accent));
    color: white;
    font-weight: 500;
}

/* ============================================
   Main Body & Container
   ============================================ */

html {
    background: var(--ea-bg) !important;
}

body {
    background: var(--ea-bg) !important;
    padding-top: 56px !important; /* Space for nav bar */
}

.swagger-ui {
    background: var(--ea-bg);
    color: var(--ea-text);
}

/* ============================================
   Top Bar
   ============================================ */

.swagger-ui .topbar {
    background: var(--ea-bg-card) !important;
    border-bottom: 1px solid var(--ea-border);
    padding: 12px 0;
}

.swagger-ui .topbar .download-url-wrapper {
    display: flex;
    align-items: center;
}

.swagger-ui .topbar .download-url-wrapper .select-label {
    color: var(--ea-text-muted);
}

.swagger-ui .topbar .download-url-wrapper .select-label span {
    color: var(--ea-text);
}

.swagger-ui .topbar .download-url-wrapper input[type=text] {
    background: var(--ea-bg) !important;
    border: 1px solid var(--ea-border) !important;
    color: var(--ea-text) !important;
    border-radius: var(--ea-radius-sm);
}

.swagger-ui .topbar .download-url-wrapper .download-url-button {
    background: var(--ea-primary) !important;
    border: none;
    border-radius: var(--ea-radius-sm);
}

/* ============================================
   Information Section
   ============================================ */

.swagger-ui .info {
    margin: 30px 0;
}

.swagger-ui .info .title {
    color: var(--ea-text) !important;
}

.swagger-ui .info .description,
.swagger-ui .info .description p,
.swagger-ui .info li,
.swagger-ui .info p {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .info a {
    color: var(--ea-primary-light) !important;
}

.swagger-ui .info .base-url {
    color: var(--ea-text-dim) !important;
}

/* ============================================
   Authorize Button & Modal
   ============================================ */

.swagger-ui .auth-wrapper {
    display: flex;
    align-items: center;
}

.swagger-ui .btn.authorize {
    background: transparent;
    border: 1px solid var(--ea-accent) !important;
    color: var(--ea-accent) !important;
    border-radius: var(--ea-radius-sm);
}

.swagger-ui .btn.authorize:hover {
    background: rgba(16, 185, 129, 0.1);
}

.swagger-ui .btn.authorize svg {
    fill: var(--ea-accent) !important;
}

.swagger-ui .authorization__btn.locked {
    opacity: 1;
}

.swagger-ui .authorization__btn svg {
    fill: var(--ea-accent) !important;
}

.swagger-ui .authorization__btn.unlocked svg {
    fill: var(--ea-text-dim) !important;
}

/* Auth Modal */
.swagger-ui .dialog-ux .modal-ux {
    background: var(--ea-bg-card) !important;
    border: 1px solid var(--ea-border);
    border-radius: var(--ea-radius);
}

.swagger-ui .dialog-ux .modal-ux-header {
    border-bottom: 1px solid var(--ea-border);
}

.swagger-ui .dialog-ux .modal-ux-header h3 {
    color: var(--ea-text) !important;
}

.swagger-ui .dialog-ux .modal-ux-content {
    background: var(--ea-bg-card);
}

.swagger-ui .dialog-ux .modal-ux-content p,
.swagger-ui .dialog-ux .modal-ux-content label {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .dialog-ux .modal-ux-content h4 {
    color: var(--ea-text) !important;
}

.swagger-ui .dialog-ux .modal-ux-content input[type=text],
.swagger-ui .dialog-ux .modal-ux-content input[type=password] {
    background: var(--ea-bg) !important;
    border: 1px solid var(--ea-border) !important;
    color: var(--ea-text) !important;
    border-radius: var(--ea-radius-sm);
}

.swagger-ui .auth-btn-wrapper {
    display: flex;
    gap: 8px;
}

.swagger-ui .auth-btn-wrapper .btn {
    border-radius: var(--ea-radius-sm) !important;
}

.swagger-ui .auth-btn-wrapper .btn-done {
    background: var(--ea-primary) !important;
    border: none !important;
    color: white !important;
}

/* ============================================
   Operation Blocks (Endpoints)
   ============================================ */

.swagger-ui .opblock-tag {
    color: var(--ea-text) !important;
    border-bottom: 1px solid var(--ea-border);
}

.swagger-ui .opblock-tag:hover {
    background: var(--ea-bg-card);
}

.swagger-ui .opblock-tag small {
    color: var(--ea-text-muted) !important;
}

/* GET */
.swagger-ui .opblock.opblock-get {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: var(--ea-primary) !important;
}

.swagger-ui .opblock.opblock-get .opblock-summary-method {
    background: var(--ea-primary) !important;
}

.swagger-ui .opblock.opblock-get .opblock-summary {
    border-color: var(--ea-primary) !important;
}

/* POST */
.swagger-ui .opblock.opblock-post {
    background: rgba(16, 185, 129, 0.1) !important;
    border-color: var(--ea-accent) !important;
}

.swagger-ui .opblock.opblock-post .opblock-summary-method {
    background: var(--ea-accent) !important;
}

.swagger-ui .opblock.opblock-post .opblock-summary {
    border-color: var(--ea-accent) !important;
}

/* PUT */
.swagger-ui .opblock.opblock-put {
    background: rgba(245, 158, 11, 0.1) !important;
    border-color: #f59e0b !important;
}

.swagger-ui .opblock.opblock-put .opblock-summary-method {
    background: #f59e0b !important;
}

.swagger-ui .opblock.opblock-put .opblock-summary {
    border-color: #f59e0b !important;
}

/* DELETE */
.swagger-ui .opblock.opblock-delete {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: #ef4444 !important;
}

.swagger-ui .opblock.opblock-delete .opblock-summary-method {
    background: #ef4444 !important;
}

.swagger-ui .opblock.opblock-delete .opblock-summary {
    border-color: #ef4444 !important;
}

/* PATCH */
.swagger-ui .opblock.opblock-patch {
    background: rgba(139, 92, 246, 0.1) !important;
    border-color: #8b5cf6 !important;
}

.swagger-ui .opblock.opblock-patch .opblock-summary-method {
    background: #8b5cf6 !important;
}

.swagger-ui .opblock.opblock-patch .opblock-summary {
    border-color: #8b5cf6 !important;
}

/* Common Operation Block Styles */
.swagger-ui .opblock {
    border-radius: var(--ea-radius-sm) !important;
    margin-bottom: 12px;
    box-shadow: var(--ea-shadow);
}

.swagger-ui .opblock .opblock-summary-path {
    color: var(--ea-text) !important;
}

.swagger-ui .opblock .opblock-summary-description {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .opblock .opblock-summary-method {
    border-radius: 4px;
    font-weight: 600;
}

/* Expanded Operation Block */
.swagger-ui .opblock.is-open .opblock-summary {
    border-bottom: 1px solid var(--ea-border);
}

.swagger-ui .opblock-body {
    background: var(--ea-bg-card) !important;
}

.swagger-ui .opblock-description-wrapper,
.swagger-ui .opblock-external-docs-wrapper {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .opblock-description-wrapper p,
.swagger-ui .opblock-external-docs-wrapper p {
    color: var(--ea-text-muted) !important;
}

/* ============================================
   Parameters Section
   ============================================ */

.swagger-ui .opblock-section-header {
    background: var(--ea-bg) !important;
    border-bottom: 1px solid var(--ea-border);
}

.swagger-ui .opblock-section-header h4 {
    color: var(--ea-text) !important;
}

.swagger-ui .opblock-section-header label {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .parameters-col_name {
    color: var(--ea-text) !important;
}

.swagger-ui .parameters-col_description {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .parameters-col_description p {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .parameter__name {
    color: var(--ea-text) !important;
}

.swagger-ui .parameter__name.required::after {
    color: #ef4444 !important;
}

.swagger-ui .parameter__type {
    color: var(--ea-text-dim) !important;
}

.swagger-ui .parameter__in {
    color: var(--ea-text-dim) !important;
}

.swagger-ui table tbody tr {
    background: transparent !important;
}

.swagger-ui table tbody tr td {
    border-bottom: 1px solid var(--ea-border) !important;
    color: var(--ea-text-muted);
}

.swagger-ui table thead tr th {
    color: var(--ea-text) !important;
    border-bottom: 1px solid var(--ea-border) !important;
}

/* Input Fields */
.swagger-ui input[type=text],
.swagger-ui input[type=password],
.swagger-ui input[type=email],
.swagger-ui input[type=file],
.swagger-ui input[type=search],
.swagger-ui textarea {
    background: var(--ea-bg) !important;
    border: 1px solid var(--ea-border) !important;
    color: var(--ea-text) !important;
    border-radius: var(--ea-radius-sm);
}

.swagger-ui input::placeholder,
.swagger-ui textarea::placeholder {
    color: var(--ea-text-dim) !important;
}

.swagger-ui select {
    background: var(--ea-bg) !important;
    border: 1px solid var(--ea-border) !important;
    color: var(--ea-text) !important;
    border-radius: var(--ea-radius-sm);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M2 4l4 4 4-4'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 10px center !important;
    background-size: 12px !important;
    padding-right: 28px !important;
}

/* ============================================
   Response Section
   ============================================ */

.swagger-ui .responses-wrapper {
    background: transparent;
}

.swagger-ui .responses-inner {
    background: transparent;
}

.swagger-ui .response-col_status {
    color: var(--ea-text) !important;
}

.swagger-ui .response-col_description {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .response-col_description p {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .response-col_links {
    color: var(--ea-text-muted) !important;
}

/* Response Codes */
.swagger-ui .responses-table .response:first-child td {
    padding-top: 16px;
}

/* ============================================
   Try It Out & Execute Button
   ============================================ */

.swagger-ui .try-out__btn {
    background: transparent !important;
    border: 1px solid var(--ea-primary) !important;
    color: var(--ea-primary) !important;
    border-radius: var(--ea-radius-sm) !important;
}

.swagger-ui .try-out__btn:hover {
    background: rgba(59, 130, 246, 0.1) !important;
}

.swagger-ui .btn.execute {
    background: var(--ea-primary) !important;
    border: none !important;
    border-radius: var(--ea-radius-sm) !important;
}

.swagger-ui .btn.cancel {
    background: transparent !important;
    border: 1px solid var(--ea-border) !important;
    color: var(--ea-text-muted) !important;
    border-radius: var(--ea-radius-sm) !important;
}

.swagger-ui .btn-clear {
    background: transparent !important;
    border: 1px solid var(--ea-border) !important;
    color: var(--ea-text-muted) !important;
    border-radius: var(--ea-radius-sm) !important;
}

/* ============================================
   Code Blocks & Responses
   ============================================ */

.swagger-ui .highlight-code,
.swagger-ui .example,
.swagger-ui .microlight {
    background: var(--ea-bg) !important;
    border-radius: var(--ea-radius-sm);
    border: 1px solid var(--ea-border);
}

.swagger-ui .microlight {
    color: var(--ea-text) !important;
}

.swagger-ui pre {
    background: var(--ea-bg) !important;
    color: var(--ea-text) !important;
}

/* Keep version badge pre tags transparent so badge color shows through */
.swagger-ui .info .title small pre {
    background: transparent !important;
    color: white !important;
    padding: 0;
    margin: 0;
}

.swagger-ui .copy-to-clipboard {
    background: var(--ea-bg-card) !important;
    border-radius: 4px;
}

.swagger-ui .copy-to-clipboard button {
    background: transparent !important;
}

/* Live Response */
.swagger-ui .live-responses-table .response-col_status {
    color: var(--ea-text) !important;
}

.swagger-ui .responses-header .col_header {
    color: var(--ea-text) !important;
}

.swagger-ui .response-control-media-type__title {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .response-control-media-type--accept-controller select {
    background: var(--ea-bg) !important;
    border: 1px solid var(--ea-border) !important;
    color: var(--ea-text) !important;
}

/* ============================================
   Models Section
   ============================================ */

.swagger-ui section.models {
    border: 1px solid var(--ea-border);
    border-radius: var(--ea-radius);
    background: var(--ea-bg-card);
}

.swagger-ui section.models h4 {
    color: var(--ea-text) !important;
}

.swagger-ui section.models .model-container {
    background: var(--ea-bg) !important;
    border-radius: var(--ea-radius-sm);
    margin: 8px 0;
}

.swagger-ui .model-box {
    background: var(--ea-bg) !important;
}

.swagger-ui .model {
    color: var(--ea-text) !important;
}

.swagger-ui .model-title {
    color: var(--ea-text) !important;
}

.swagger-ui .model .property {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .model .property.primitive {
    color: var(--ea-primary-light) !important;
}

.swagger-ui .prop-type {
    color: var(--ea-primary-light) !important;
}

.swagger-ui .prop-format {
    color: var(--ea-text-dim) !important;
}

/* ============================================
   Loading States
   ============================================ */

.swagger-ui .loading-container {
    background: var(--ea-bg);
}

.swagger-ui .loading-container .loading::before {
    border-color: var(--ea-primary);
    border-top-color: transparent;
}

/* ============================================
   Scrollbars (Webkit)
   ============================================ */

.swagger-ui ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.swagger-ui ::-webkit-scrollbar-track {
    background: var(--ea-bg);
}

.swagger-ui ::-webkit-scrollbar-thumb {
    background: var(--ea-border);
    border-radius: 4px;
}

.swagger-ui ::-webkit-scrollbar-thumb:hover {
    background: var(--ea-text-dim);
}

/* ============================================
   SVG Icons (Arrows, Expand/Collapse)
   ============================================ */

.swagger-ui svg:not(:root) {
    fill: var(--ea-text-muted);
}

.swagger-ui .opblock-summary-control .arrow {
    fill: var(--ea-text-muted) !important;
}

.swagger-ui .expand-operation svg {
    fill: var(--ea-text-muted) !important;
}

.swagger-ui .model-toggle::after {
    color: var(--ea-text-muted) !important;
}

.swagger-ui section.models h4 svg {
    fill: var(--ea-text-muted) !important;
}

/* ============================================
   Misc
   ============================================ */

.swagger-ui .wrapper {
    padding: 0 20px;
}

.swagger-ui .scheme-container {
    background: var(--ea-bg-card) !important;
    box-shadow: none;
    border-bottom: 1px solid var(--ea-border);
}

.swagger-ui .schemes-title {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .servers-title {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .servers > label select {
    background: var(--ea-bg) !important;
    border: 1px solid var(--ea-border) !important;
    color: var(--ea-text) !important;
}

.swagger-ui a {
    color: var(--ea-primary-light);
}

.swagger-ui .markdown p,
.swagger-ui .markdown li {
    color: var(--ea-text-muted) !important;
}

.swagger-ui .markdown code {
    background: var(--ea-bg) !important;
    color: var(--ea-primary-light) !important;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Filter/Search */
.swagger-ui .filter-container {
    background: var(--ea-bg-card);
    border-bottom: 1px solid var(--ea-border);
}

.swagger-ui .filter-container .filter {
    background: var(--ea-bg-card);
}

.swagger-ui .filter-container input[type=text] {
    background: var(--ea-bg) !important;
    border: 1px solid var(--ea-border) !important;
    color: var(--ea-text) !important;
}

/* Version Selector */
.swagger-ui .version-pragma {
    background: var(--ea-bg-card);
    border: 1px solid var(--ea-border);
    border-radius: var(--ea-radius-sm);
}

.swagger-ui .version-pragma__message {
    color: var(--ea-text-muted) !important;
}

/* Errors */
.swagger-ui .errors-wrapper {
    background: rgba(239, 68, 68, 0.1) !important;
    border: 1px solid #ef4444;
    border-radius: var(--ea-radius-sm);
}

.swagger-ui .errors-wrapper h4 {
    color: #ef4444 !important;
}
