/* WebApp — inherits the design tokens from site.css */

:root {
    --background: var(--paper);
    --text-primary: var(--ink);
    --status-connected: var(--climb);
    --status-disconnected: #9AA8B6;
    --status-error: var(--sink);
    --button-secondary-border: var(--line);
}

body { background: var(--mist); }

/* ================================================================ */
/*                          STATUS BAR                               */
/* ================================================================ */

.status-bar {
    background-color: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 12px max(28px, calc((100% - var(--wrap)) / 2 + 28px));
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: background-color 0.3s, box-shadow 0.3s, border 0.3s;
}

.status-indicator.disconnected {
    background-color: transparent;
    border: 1.5px solid var(--status-disconnected);
}

.status-indicator.connected {
    background-color: var(--status-connected);
    border: none;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}

.status-indicator.scanning {
    background-color: var(--primary);
    border: none;
    animation: pulse 1.2s ease-in-out infinite;
}

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

.status-text {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
}

.device-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    margin-left: auto;
}

/* ================================================================ */
/*                          MAIN CONTENT                             */
/* ================================================================ */

.main-content {
    width: 100%;
    max-width: 520px;
    margin: 40px auto 72px;
    padding: 32px;
    background: var(--paper);
    border-radius: var(--r-panel);
    box-shadow: 0 1px 2px rgba(18, 38, 58, 0.06), 0 12px 32px rgba(18, 38, 58, 0.06);
}

@media (max-width: 600px) {
    .main-content { margin: 0; border-radius: 0; box-shadow: none; padding: 24px 20px 48px; }
}

.logo {
    display: block;
    width: 180px;
    max-width: 60%;
    height: auto;
    margin: 0 auto 28px;
}

/* ================================================================ */
/*                           BUTTONS                                 */
/* ================================================================ */

.btn-primary-custom {
    display: block;
    width: 100%;
    padding: 15px 20px;
    background-color: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary-custom:hover {
    background-color: var(--primary-dark);
}

.btn-primary-custom:active {
    background-color: var(--primary-dark);
    transform: scale(0.98);
}

.btn-secondary-custom {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background-color: var(--on-primary);
    color: var(--text-primary);
    border: 1.5px solid var(--button-secondary-border);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
}

.btn-secondary-custom:hover {
    background-color: var(--mist);
    border-color: var(--ink-2);
}

.btn-secondary-custom:active {
    background-color: var(--surface);
    transform: scale(0.98);
}

.btn-disconnect {
    background-color: transparent;
    color: var(--status-error);
    border: 1.5px solid var(--status-error);
}

.btn-disconnect:hover {
    background-color: rgba(239, 68, 68, 0.05);
    border-color: var(--status-error);
}

/* ================================================================ */
/*                       SCANNING INDICATOR                          */
/* ================================================================ */

.scanning-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 0;
    margin-bottom: 8px;
}

.scanning-indicator.visible {
    display: flex;
}

.scanning-spinner {
    width: 20px;
    height: 20px;
    border: 2.5px solid var(--divider);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.scanning-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* ================================================================ */
/*                        SECTION HEADERS                            */
/* ================================================================ */

.section-header {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* ================================================================ */
/*                        QUICK ACTIONS                              */
/* ================================================================ */

.quick-actions {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.quick-actions .btn-secondary-custom {
    flex: 1;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ================================================================ */
/*                      CONFIGURATION CARD                           */
/* ================================================================ */

.config-card {
    background-color: var(--mist);
    border-radius: 16px;
    padding: 20px;
    margin-top: 16px;
}

.config-item {
    text-align: center;
}

.config-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.config-item-title .arrow {
    font-size: 14px;
}

.config-item-title .arrow.up {
    color: var(--climb);
}

.config-item-title .arrow.down {
    color: var(--status-error);
}

.config-item-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.4;
}

.config-divider {
    height: 1px;
    background-color: var(--divider);
    margin: 16px 0;
}

/* ================================================================ */
/*                         INPUT FIELDS                              */
/* ================================================================ */

.input-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.input-field {
    width: 120px;
    padding: 10px 12px;
    background-color: var(--on-primary);
    border: 1px solid var(--divider);
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    text-align: center;
    outline: none;
    transition: border-color 0.2s;
}

.input-field:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(58, 176, 240, 0.25);
}

.input-unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ================================================================ */
/*                        RADIO BUTTONS                              */
/* ================================================================ */

.radio-group {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.radio-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.radio-group input[type="radio"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* ================================================================ */
/*                         TOAST MESSAGE                             */
/* ================================================================ */

.toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
}

.toast-message {
    background-color: var(--text-primary);
    color: var(--on-primary);
    padding: 12px 24px;
    border-radius: var(--border-radius);
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    white-space: nowrap;
}

.toast-message.visible {
    opacity: 1;
}

/* ================================================================ */
/*                          HIDDEN UTILITY                           */
/* ================================================================ */

.hidden {
    display: none !important;
}

/* ================================================================ */
/*                        ERROR MESSAGE                              */
/* ================================================================ */

.error-text {
    color: var(--status-error);
    font-size: 13px;
    text-align: center;
    margin-top: 8px;
}

/* ================================================================ */
/*                       NOT SUPPORTED BANNER                        */
/* ================================================================ */

.not-supported {
    text-align: center;
    padding: 40px 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

.not-supported strong {
    color: var(--status-error);
}

/* ================================================================ */
/*                     BUSY STATE & CONNECT HINT                     */
/* ================================================================ */

.btn-primary-custom:disabled,
.btn-secondary-custom:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.connect-hint {
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-secondary);
    text-align: center;
}
