/* global.css */
:root {
    /* Brand & Action Colors */
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-danger: #dc2626;

    /* Feedback Backgrounds */
    --bg-success: #d1fae5;
    --bg-error: pink;

    /* Text Colors */
    --text-main: #111827; /* Standard body text */
    --text-medium: #1f2937; /* Buttons, inputs, read-only text */
    --text-secondary: #2d333d; /* Labels, navigation, descriptions */
    --text-tertiary: #4b5563; /* Helper text */
    --text-disabled: #9ca3af; /* Disabled text, icons, placeholders */

    /* Background Colors */
    --bg-body: #f3f4f6; /* Main page background */
    --bg-surface: white; /* Panels, cards, header */
    --bg-element: #f9fafb; /* Link buttons */
    --bg-element-alt: #e5e7eb; /* Read-only fields, small buttons */
    --bg-hover: #d1d5db; /* Small button hovers, disabled button bg */

    /* Borders */
    --border-main: #d1d5db; /* Standard inputs, structural borders */
    --border-light: #e5e7eb; /* Dividers, subtle borders */

    /* Shadows */
    --shadow-card: 0 2px 4px -1px rgba(0, 0, 0, 0.1);
    --shadow-dropdown: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-btn: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    padding: 1rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

a {
    text-decoration: none;
}

/* --- Utility Classes --- */
.hidden {
    /* biome-ignore lint/complexity/noImportantStyles: asf*/
    display: none !important;
}
.mono-space {
    font-family: ui-monospace, monospace;
}
.btn-copied {
    background-color: var(--bg-success) !important;
}
.w-7rem {
    width: 7rem !important;
}
.w-3rem {
    width: 3rem !important;
}
.min-h-80 {
    min-height: 80px;
}

/* --- App Header --- */
.app-header {
    background-color: var(--bg-surface);
    border-radius: 8px;
    box-shadow: var(--shadow-card);
    margin-bottom: 0.5rem;
    padding: 0.5rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;

    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}

.header-title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-primary);
    font-weight: 700;
}

.header-nav {
    display: flex;
    gap: 0.5rem 1.5rem;
    align-items: center;

    flex-wrap: wrap;
    justify-content: center;
}

.header-nav a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.85rem;
    transition: color 0.2s ease;
}
.header-nav a:hover {
    color: var(--color-primary);
}

/* --- GitHub Link --- */
.github-link {
    display: inline-block;
    width: 16px;
    height: 16px;
    opacity: 0.8;
    transition: opacity 0.2s ease;

    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%234b5563' d='M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.github-link:hover {
    opacity: 1;
}

/* --- App Footer --- */
.app-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    color: var(--text-tertiary);
    font-size: 0.85rem;
}

.app-footer p {
    margin: 0;
}

.app-footer a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-decoration-color: var(--border-main);
    transition:
        color 0.2s ease,
        text-decoration-color 0.2s ease;
}

.app-footer a:hover {
    color: var(--color-primary);
    text-decoration-color: var(--color-primary);
}

/* --- Layout Wrappers --- */
.main-wrapper {
    width: 100%;
    max-width: 1000px;
    position: relative;
}

.full-width-section {
    background: var(--bg-surface);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow-card);
    margin-bottom: 1rem;
}

.container {
    display: flex;
    gap: 1rem;
    width: 100%;
    margin-bottom: 1rem;
}

.column {
    flex: 1;
    background: var(--bg-surface);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
}

.section-divider {
    margin: 1rem 0;
    border: 0;
    border-top: 1px solid var(--border-light);
}

/* --- Typography --- */
h2,
h3 {
    margin-top: 0;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid var(--border-light);
    color: var(--color-primary);
    margin-bottom: 0.75rem;
    font-size: 1.25rem;
}
h3 {
    font-size: 1.1rem;
}

.description-text {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

label {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* --- Form Elements --- */
.field {
    margin-bottom: 0.75rem;
}
.field-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.field-inline label {
    margin-bottom: 0;
    white-space: nowrap;
}

.helper-text {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}
.required {
    color: var(--color-danger);
    margin-left: 0.1rem;
    font-weight: bold;
}
.flex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.2rem;
}
.flex-header label {
    margin-bottom: 0;
}

.checkbox-group {
    display: flex;
    gap: 2rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-main);
}
.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: help;
}
.checkbox-label input {
    margin-right: 0.4rem;
}

.radio-group {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-main);
}
.radio-label {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}
.radio-label input {
    margin-right: 0.25rem;
}

input[type="text"],
input[type="number"],
textarea {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid var(--border-main);
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 0.9rem;
}

input.invalid {
    background-color: var(--bg-error);
}

textarea {
    resize: vertical;
    min-height: 60px;
}
textarea[readonly] {
    background-color: var(--bg-element-alt);
    cursor: default;
    color: var(--text-medium);
}
textarea[readonly]:focus {
    outline: none;
    border-color: var(--border-main);
}

/* --- Clear Buttons & Textarea Containers --- */
.clear-btn {
    position: absolute;
    right: 8px;
    top: 6px;
    background: none;
    border: none;
    color: var(--text-disabled);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    z-index: 2;
}
.clear-btn:hover {
    color: var(--color-danger);
}

.textarea-container {
    position: relative;
    width: 100%;
}
.textarea-container textarea {
    padding-right: 32px;
    padding-left: 0.4rem;
}
.textarea-container .clear-btn {
    top: 10px;
    right: 20px;
}

/* --- Combobox --- */
.combo-container {
    position: relative;
    flex: 1;
}
.combo-container input[type="text"] {
    padding-right: 28px;
    padding-left: 0.4rem;
}
.combo-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    margin-top: 2px;
    border: 1px solid var(--border-main);
    border-radius: 4px;
    background: var(--bg-surface);
    z-index: 10;
    box-shadow: var(--shadow-dropdown);
}
.combo-container.open .combo-dropdown {
    display: block;
}
select.combo-select {
    width: 100%;
    border: none;
    outline: none;
    padding: 2px;
    font-family: inherit;
    background: transparent;
}
select.combo-select option {
    padding: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}
select.combo-select option:hover,
select.combo-select option:checked {
    background-color: var(--color-primary);
    color: white;
}

/* --- Buttons --- */
.btn-small {
    background-color: var(--bg-element-alt);
    color: var(--text-medium);
    border: 1px solid var(--border-main);
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-small:hover {
    background-color: var(--bg-hover);
}

.btn-transform {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 0.75rem 2.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
    box-shadow: var(--shadow-btn);
    transition:
        background-color 0.2s,
        transform 0.1s;
}
.btn-transform:hover:not(:disabled) {
    background-color: var(--color-primary-hover);
}
.btn-transform:active:not(:disabled) {
    transform: translateY(2px);
}
.btn-transform:disabled {
    background-color: var(--bg-hover);
    color: var(--text-disabled);
    cursor: not-allowed;
    box-shadow: none;
}
.action-area {
    text-align: center;
    margin-bottom: 1rem;
}
.center-btn-container {
    text-align: center;
    margin-top: 0.75rem;
}

/* --- Links & Icons --- */
.input-with-link {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    width: 100%;
}
.info-link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    width: 32px;
    height: 32px;
    background: var(--bg-element);
    border: 1px solid var(--border-main);
    border-radius: 4px;
    font-size: 1.1rem;
    transition: background 0.2s;
}
.info-link:hover {
    background: var(--bg-element-alt);
}
.info-link.disabled,
.disabled {
    pointer-events: none;
    opacity: 0.4;
    filter: grayscale(100%);
}

/* --- Summary Boxes --- */
.summary-header {
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0.25rem;
    margin-bottom: 0.75rem;
}
.summary-header h3 {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.summary-box {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-main);
    border-radius: 4px;
    background-color: var(--bg-element-alt);
    color: var(--text-medium);
    font-size: 0.9rem;
    min-height: 60px;
    box-sizing: border-box;
    white-space: pre-wrap;
    line-height: 1.4;
}

/* --- Loading Indicator --- */
#loading-indicator {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    z-index: 100;
    animation: pulse 3.5s infinite;
}
@keyframes pulse {
    0% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(0.9);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }
    100% {
        opacity: 0.3;
        transform: translate(-50%, -50%) scale(0.9);
    }
}
.loading-state {
    opacity: 0.4;
    pointer-events: none;
    filter: grayscale(20%);
    transition: opacity 0.3s;
}

/* --- Media Queries --- */
@media (max-width: 768px) {
    .app-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    .container {
        flex-direction: column;
    }
    .field-inline {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
}
