/**
 * IA Endpoint Browser - Stylesheet
 * Interactive API Documentation Explorer
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #fafafa;
    color: #3b4151;
    line-height: 1.6;
}

.header {
    background: linear-gradient(135deg, #e3e3ed 0%, #16213e 100%);
    color: white;
    padding: 20px 40px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

    .header .description {
        color:black;
    }

    .header .header-logo {
        height: 24px;
    }


.header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header p {
    opacity: 0.8;
    font-size: 14px;
    margin-top: 5px;
}

/* Server Selector */
.server-selector {
    background: #e8f4fc;
    border-bottom: 1px solid #b8daef;
    padding: 15px 40px;
}

.server-selector-inner {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.server-selector label {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 14px;
}

.server-select {
    padding: 10px 15px;
    border: 2px solid #61affe;
    border-radius: 6px;
    font-size: 14px;
    min-width: 300px;
    background: white;
    cursor: pointer;
    font-family: inherit;
}

.server-select:focus {
    outline: none;
    border-color: #1a1a2e;
}

.server-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.server-status .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ccc;
}

.server-status .dot.loading {
    background: #ffc107;
    animation: pulse 1s infinite;
}

.server-status .dot.connected {
    background: #49cc90;
}

.server-status .dot.error {
    background: #f93e3e;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.reload-btn {
    background: #61affe;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.reload-btn:hover {
    background: #4a9ae8;
}

.reload-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* License Key Section */
.license-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    padding-left: 20px;
    border-left: 1px solid #b8daef;
}

.license-section label {
    font-weight: 600;
    color: #1a1a2e;
    font-size: 14px;
    white-space: nowrap;
}

.license-input-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.license-input {
    padding: 8px 12px;
    border: 2px solid #49cc90;
    border-radius: 6px;
    font-size: 13px;
    width: 200px;
    font-family: monospace;
}

.license-input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.license-input.has-value {
    background: #d4edda;
}

.license-btn {
    background: #49cc90;
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}

.license-btn:hover {
    background: #3db87a;
}

.license-btn.clear {
    background: #f93e3e;
}

.license-btn.clear:hover {
    background: #e02d2d;
}

.license-status {
    font-size: 12px;
    color: #666;
}

.license-status.active {
    color: #155724;
    font-weight: 600;
}

.api-info {
    display: none;
    background: white;
    padding: 20px 40px;
    border-bottom: 1px solid #e0e0e0;
}

.api-info h2 {
    font-size: 28px;
    color: #1a1a2e;
}

.api-info .version {
    display: inline-block;
    background: #49cc90;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

.api-info .description {
    margin-top: 10px;
    color: #666;
}

.api-info .base-url-section {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.api-info .base-url-label {
    font-weight: 600;
    color: #1a1a2e;
}

.api-info .base-url-input {
    font-family: monospace;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ddd;
    min-width: 400px;
    font-size: 14px;
}

.api-info .base-url-input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 40px;
}

.tag-section {
    margin-bottom: 20px;
}

.tag-header {
    background: #f0f0f0;
    padding: 15px 20px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #ddd;
}

.tag-header:hover {
    background: #e8e8e8;
}

.tag-header h3 {
    font-size: 18px;
    color: #1a1a2e;
}

.tag-header .count {
    background: #1a1a2e;
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
}

.tag-content {
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
}

.endpoint {
    border-bottom: 1px solid #eee;
    background: white;
}

.endpoint:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

.endpoint-header {
    padding: 15px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 15px;
}

.endpoint-header:hover {
    background: #f9f9f9;
}

.method {
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    min-width: 70px;
    text-align: center;
}

.method.get { background: #61affe; color: white; }
.method.post { background: #49cc90; color: white; }
.method.put { background: #fca130; color: white; }
.method.delete { background: #f93e3e; color: white; }
.method.patch { background: #50e3c2; color: white; }

.endpoint-path {
    font-family: monospace;
    font-size: 14px;
    font-weight: 600;
    flex-grow: 1;
}

.endpoint-summary {
    color: #666;
    font-size: 13px;
}

.endpoint-details {
    display: none;
    padding: 20px;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.endpoint-details.open {
    display: block;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
    margin: 15px 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #ddd;
}

.section-title:first-child {
    margin-top: 0;
}

.params-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.params-table th {
    text-align: left;
    padding: 10px;
    background: #f0f0f0;
    font-weight: 600;
}

.params-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.param-name {
    font-family: monospace;
    font-weight: 600;
}

.param-required {
    color: #f93e3e;
    font-size: 11px;
    margin-left: 5px;
}

.param-type {
    font-family: monospace;
    color: #666;
    font-size: 12px;
}

.param-in {
    background: #eee;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.schema-box {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
}

.response-code {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
    margin-right: 10px;
}

.response-code.success { background: #d4edda; color: #155724; }
.response-code.error { background: #f8d7da; color: #721c24; }
.response-code.redirect { background: #fff3cd; color: #856404; }

.response-item {
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #eee;
}

.loading {
    text-align: center;
    padding: 60px;
    color: #666;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #1a1a2e;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
}

.no-params {
    color: #999;
    font-style: italic;
    padding: 10px;
}

.expand-icon {
    transition: transform 0.2s;
}

.expand-icon.open {
    transform: rotate(180deg);
}

/* Try It Out Styles */
.try-it-section {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    border: 2px solid #61affe;
}

.try-it-section.post { border-color: #49cc90; }
.try-it-section.put { border-color: #fca130; }
.try-it-section.delete { border-color: #f93e3e; }
.try-it-section.patch { border-color: #50e3c2; }

.try-it-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.try-it-header h4 {
    color: #1a1a2e;
    font-size: 16px;
}

.try-it-toggle {
    background: #61affe;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}

.try-it-toggle:hover {
    opacity: 0.9;
}

.try-it-toggle.cancel {
    background: #6c757d;
}

.try-it-form {
    display: none;
}

.try-it-form.active {
    display: block;
}

.param-input-group {
    margin-bottom: 15px;
}

.param-input-label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    font-size: 13px;
}

.param-input-label .param-location {
    font-weight: normal;
    color: #666;
    margin-left: 8px;
}

.param-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
}

.param-input:focus {
    outline: none;
    border-color: #61affe;
}

.param-input.required {
    border-left: 3px solid #f93e3e;
}

/* File Input Styles */
.file-input-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-input {
    flex: 1;
}

.file-input::file-selector-button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 13px;
    margin-right: 10px;
}

.file-input::file-selector-button:hover {
    background: #e8e8e8;
}

.file-name {
    font-size: 12px;
    color: #666;
    font-family: monospace;
}

.body-textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: monospace;
    font-size: 13px;
    resize: vertical;
}

.body-textarea:focus {
    outline: none;
    border-color: #61affe;
}

.execute-btn {
    background: #4990e2;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.execute-btn:hover {
    background: #3a7bc8;
}

.execute-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.execute-btn.loading {
    position: relative;
    color: transparent;
}

.execute-btn.loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.button-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
}

.clear-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.clear-btn:hover {
    background: #5a6268;
}

.cancel-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
}

.cancel-btn:hover {
    background: #c82333;
}

/* Response Display */
.response-display {
    margin-top: 20px;
    display: none;
}

.response-display.visible {
    display: block;
}

.response-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.response-status {
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 700;
    font-size: 14px;
}

.response-status.success {
    background: #d4edda;
    color: #155724;
}

.response-status.error {
    background: #f8d7da;
    color: #721c24;
}

.response-time {
    color: #666;
    font-size: 13px;
}

.response-tabs {
    display: flex;
    border-bottom: 1px solid #ddd;
    margin-bottom: 15px;
}

.response-tab {
    padding: 10px 20px;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.response-tab:hover {
    color: #1a1a2e;
}

.response-tab.active {
    color: #1a1a2e;
    border-bottom-color: #1a1a2e;
}

.response-content {
    display: none;
}

.response-content.active {
    display: block;
}

.response-body-box {
    background: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 13px;
    overflow-x: auto;
    white-space: pre-wrap;
    max-height: 400px;
    overflow-y: auto;
}

.response-headers-list {
    font-family: monospace;
    font-size: 13px;
}

.response-headers-list div {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

.response-headers-list .header-name {
    color: #1a1a2e;
    font-weight: 600;
}

.curl-box {
    background: #1a1a2e;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 12px;
    overflow-x: auto;
    white-space: pre-wrap;
}

.copy-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-bottom: 10px;
}

.copy-btn:hover {
    background: #5a6268;
}

.search-box {
    padding: 20px 40px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.search-input {
    width: 100%;
    max-width: 500px;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #1a1a2e;
}

.hidden {
    display: none !important;
}

.schemas-section {
    margin-top: 40px;
}

.schema-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    overflow: hidden;
}

.schema-header {
    padding: 15px 20px;
    background: #f8f8f8;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.schema-header:hover {
    background: #f0f0f0;
}

.schema-name {
    font-family: monospace;
    font-weight: 600;
    color: #1a1a2e;
}

.schema-content {
    display: none;
    padding: 20px;
}

.schema-content.open {
    display: block;
}

.property-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.property-row:last-child {
    border-bottom: none;
}

.property-name {
    font-family: monospace;
    font-weight: 600;
    min-width: 200px;
}

.property-type {
    font-family: monospace;
    color: #666;
    min-width: 150px;
}

.property-desc {
    color: #666;
    font-size: 13px;
}

.no-servers {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    margin: 20px 40px;
}

.no-servers h3 {
    color: #856404;
    margin-bottom: 10px;
}

.no-servers p {
    color: #856404;
    font-size: 14px;
}

.no-servers code {
    background: #ffeeba;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.spec-url {
    font-family: monospace;
    font-size: 12px;
    color: #666;
    margin-left: 15px;
    padding: 4px 8px;
    background: #f0f0f0;
    border-radius: 4px;
}

.multipart-notice {
    background: #e7f3ff;
    border: 1px solid #b8daff;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    color: #004085;
    margin-bottom: 10px;
}

/* Single Server Mode - hide server selector when only one server is configured and available */
.server-selector.single-server label[for="serverSelect"],
.server-selector.single-server .server-select,
.server-selector.single-server .reload-btn,
.server-selector.single-server .server-status,
.server-selector.single-server .spec-url {
    display: none !important;
}

.server-selector.single-server .license-section {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
}

/* ========== Responsive Design ========== */

@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
    }

    .header h1 {
        font-size: 20px;
    }

    .server-selector {
        padding: 12px 16px;
    }

    .server-selector-inner {
        flex-direction: column;
        align-items: stretch;
    }

    .server-select {
        min-width: 0;
        width: 100%;
    }

    .reload-btn {
        align-self: flex-start;
    }

    .server-status {
        order: -1;
    }

    .license-section {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        padding-top: 12px;
        border-top: 1px solid #b8daef;
        flex-wrap: wrap;
    }

    .license-input {
        flex: 1;
        min-width: 0;
    }

    .api-info {
        padding: 15px 20px;
    }

    .api-info h2 {
        font-size: 22px;
    }

    .api-info .base-url-section {
        flex-direction: column;
        align-items: stretch;
    }

    .api-info .base-url-input {
        min-width: 0;
        width: 100%;
    }

    .search-box {
        padding: 15px 16px;
    }

    .search-input {
        max-width: 100%;
    }

    .container {
        padding: 15px 16px;
    }

    .endpoint-header {
        flex-wrap: wrap;
        padding: 12px 16px;
        gap: 8px;
    }

    .endpoint-path {
        flex: 1 1 calc(100% - 100px);
        word-break: break-all;
    }

    .endpoint-summary {
        width: 100%;
        order: 4;
    }

    .endpoint-details {
        padding: 15px;
    }

    .params-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .try-it-section {
        padding: 15px;
    }

    .try-it-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .property-row {
        flex-direction: column;
        gap: 4px;
    }

    .property-name {
        min-width: 0;
    }

    .property-type {
        min-width: 0;
    }

    .button-row {
        flex-wrap: wrap;
    }

    .execute-btn,
    .clear-btn,
    .cancel-btn {
        min-height: 44px;
    }

    .response-tabs {
        flex-wrap: wrap;
    }

    .response-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    .spec-url {
        display: block;
        margin-left: 0;
        margin-top: 8px;
        word-break: break-all;
    }

    .schema-item .schema-header {
        padding: 12px 16px;
    }

    .schema-content {
        padding: 15px;
    }

    .tag-header {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 12px 16px;
    }

    .header h1 {
        font-size: 18px;
    }

    .header p {
        font-size: 12px;
    }

    .tag-header h3 {
        font-size: 16px;
    }

    .method {
        min-width: 55px;
        padding: 4px 8px;
        font-size: 11px;
    }

    .endpoint-path {
        font-size: 12px;
    }

    .endpoint-summary {
        font-size: 12px;
    }

    .body-textarea {
        min-height: 120px;
        font-size: 12px;
    }

    .response-body-box,
    .curl-box {
        font-size: 11px;
        padding: 10px;
    }

    .try-it-header h4 {
        font-size: 14px;
    }

    .api-info h2 {
        font-size: 18px;
        line-height: 1.3;
    }

    .api-info .version {
        display: block;
        margin-left: 0;
        margin-top: 8px;
        width: fit-content;
    }

    .login-card {
        margin: 40px 20px;
        padding: 30px 20px;
    }

    .login-card h2 {
        font-size: 20px;
    }

    .login-input {
        width: 100%;
    }
}

/* Login Screen */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    background: #fafafa;
}

.login-screen.hidden {
    display: none;
}

.login-card {
    background: white;
    border-radius: 12px;
    padding: 50px 40px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 440px;
    width: 100%;
}

.login-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.login-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 8px;
}

.login-card > p {
    color: #666;
    font-size: 14px;
    margin-bottom: 28px;
}

.login-form {
    display: flex;
    gap: 10px;
}

.login-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-family: monospace;
    transition: border-color 0.2s;
}

.login-input:focus {
    outline: none;
    border-color: #61affe;
}

.login-btn {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    border: none;
    padding: 12px 28px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.login-btn:hover {
    opacity: 0.9;
}

.login-error {
    display: block;
    color: #f93e3e;
    font-size: 13px;
    margin-top: 14px;
}

.login-error.hidden {
    display: none;
}

/* App Content (hidden until logged in) */
.app-content.hidden {
    display: none;
}
