/* ============================================================
   Criter — Swagger UI Custom Theme
   ============================================================ */

/* --- Top bar --- */
.swagger-ui .topbar {
    background-color: #16395e;
    padding: 6px 0;
}

/* Hide default Swagger logo and replace with Criter logo */
.swagger-ui .topbar-wrapper .link {
    display: flex;
    align-items: center;
}

.swagger-ui .topbar-wrapper .link svg {
    display: none;
}

.swagger-ui .topbar-wrapper .link::before {
    content: '';
    display: inline-block;
    width: 480px;
    height: 100px;
    background-image: url('/assets/images/criterlogo.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

.swagger-ui .topbar-wrapper .link span {
    display: none;
}

.swagger-ui .topbar a {
    color: #ffffff;
}

.swagger-ui .topbar .download-url-wrapper .select-label select {
    border-color: rgba(255, 255, 255, 0.5);
}

/* --- Authorize button --- */
.swagger-ui .btn.authorize {
    border-color: #16395e;
    color: #16395e;
}

.swagger-ui .btn.authorize svg {
    fill: #16395e;
}

/* --- Info section --- */
.swagger-ui .info .title {
    color: #16395e;
}

/* --- Description area styling --- */
.swagger-ui .info .description h2 {
    color: #16395e;
    border-bottom: 2px solid #e8edf2;
    padding-bottom: 6px;
    margin-top: 24px;
}

.swagger-ui .info .description h3 {
    color: #2a6496;
    margin-top: 16px;
}

.swagger-ui .info .description code {
    background-color: #f0f4f8;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #16395e;
}

.swagger-ui .info .description table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
}

.swagger-ui .info .description table th {
    background-color: #16395e;
    color: #fff;
    padding: 8px 12px;
    text-align: left;
}

.swagger-ui .info .description table td {
    padding: 8px 12px;
    border-bottom: 1px solid #e8edf2;
}

.swagger-ui .info .description table tr:nth-child(even) {
    background-color: #f8fafc;
}

/* --- Required fields badge --- */
.swagger-ui .info .description .badge-required {
    display: inline-block;
    background-color: #d9534f;
    color: #fff;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 0.75em;
    vertical-align: middle;
    margin-left: 4px;
}

/* --- Callout boxes --- */
.swagger-ui .info .description blockquote {
    border-left: 4px solid #16395e;
    background-color: #f0f4f8;
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 0 4px 4px 0;
}

/* --- Tag (controller) group headers --- */
.swagger-ui .opblock-tag {
    border-bottom: 2px solid #e8edf2;
}

.swagger-ui .opblock-tag:hover {
    background-color: #f8fafc;
}

/* ============================================================
   Tab Navigation — Developer Portal Description Area
   ============================================================ */

/* Tab bar container */
.criter-tab-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border-bottom: 3px solid #16395e;
    margin: 20px 0 0 0;
    padding: 0;
}

/* Individual tab button */
.criter-tab-btn {
    padding: 10px 20px;
    cursor: pointer;
    background-color: #e8edf2;
    border: 1px solid #ccd5de;
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: #3b5a7a;
    transition: background-color 0.2s, color 0.2s;
    margin-right: 2px;
    user-select: none;
    white-space: nowrap;
}

.criter-tab-btn:hover {
    background-color: #d0dae5;
    color: #16395e;
}

.criter-tab-btn.active {
    background-color: #16395e;
    color: #ffffff;
    border-color: #16395e;
}

/* Tab panel (hidden by default) */
.criter-tab-panel {
    display: none;
    padding: 20px 4px;
    animation: criterFadeIn 0.25s ease-in;
}

.criter-tab-panel.active {
    display: block;
}

@keyframes criterFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --- Tab content refinements --- */
.criter-tab-panel h3 {
    color: #16395e;
    border-bottom: 2px solid #e8edf2;
    padding-bottom: 6px;
    margin-top: 20px;
    margin-bottom: 12px;
    font-size: 15px;
}

.criter-tab-panel h3:first-child {
    margin-top: 0;
}

.criter-tab-panel h4 {
    color: #2a6496;
    margin-top: 14px;
    margin-bottom: 8px;
    font-size: 13px;
}

.criter-tab-panel table {
    border-collapse: collapse;
    width: 100%;
    margin: 10px 0;
    font-size: 13px;
}

.criter-tab-panel table th {
    background-color: #16395e;
    color: #fff;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
}

.criter-tab-panel table td {
    padding: 7px 12px;
    border-bottom: 1px solid #e8edf2;
}

.criter-tab-panel table tr:nth-child(even) {
    background-color: #f8fafc;
}

.criter-tab-panel code {
    background-color: #f0f4f8;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #16395e;
}

.criter-tab-panel pre {
    background-color: #1e293b;
    color: #e2e8f0;
    padding: 14px 18px;
    border-radius: 6px;
    overflow-x: auto;
    font-size: 12.5px;
    line-height: 1.5;
    margin: 10px 0;
}

.criter-tab-panel pre code {
    background: none;
    color: inherit;
    padding: 0;
}

/* Callout boxes inside tabs */
.criter-callout {
    border-left: 4px solid #16395e;
    background-color: #f0f4f8;
    padding: 12px 16px;
    margin: 12px 0;
    border-radius: 0 4px 4px 0;
    font-size: 13px;
}

.criter-callout-warn {
    border-left-color: #e6a817;
    background-color: #fef9ec;
}

.criter-callout-danger {
    border-left-color: #d9534f;
    background-color: #fdf2f2;
}

.criter-callout-success {
    border-left-color: #28a745;
    background-color: #f0faf3;
}

/* State diagram styling */
.criter-state-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e8edf2;
}

.criter-state {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 12px;
    text-align: center;
}

.criter-state-bozza     { background: #fef3cd; color: #856404; border: 2px solid #ffc107; }
.criter-state-definitivo { background: #d4edda; color: #155724; border: 2px solid #28a745; }
.criter-state-annullato  { background: #f8d7da; color: #721c24; border: 2px solid #dc3545; }
.criter-state-revisionato { background: #cce5ff; color: #004085; border: 2px solid #007bff; }

.criter-arrow {
    font-size: 18px;
    color: #6c757d;
    font-weight: bold;
}

/* Intro text above tabs */
.criter-intro {
    margin-bottom: 4px;
    line-height: 1.6;
    font-size: 14px;
}
