/* ============================================
   DingsDa — Global App Styles
   ============================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-weight: 400;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background 0.2s ease, color 0.2s ease;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

a:hover {
    color: var(--accent-primary-hover);
}

button {
    font-family: var(--font-primary);
}

input, textarea, select {
    font-family: var(--font-primary);
}

/* ============================================
   Scrollbars — dezent, an das aktuelle Theme angepasst
   ============================================ */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) transparent;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* ============================================
   Brand
   ============================================ */
.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 7px;
    object-fit: contain;
}

.brand-name {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1;
}

.brand-name .d1 { color: var(--brand-d1); }
.brand-name .d2 { color: var(--brand-d2); }

.brand-slogan {
    font-size: 11px;
    font-weight: 300;
    color: var(--text-tertiary);
    letter-spacing: 0.2px;
    margin-top: 2px;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-primary);
    font-weight: 500;
    font-size: 14px;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
    line-height: 1;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-primary-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--accent-primary-light);
}

.btn-icon {
    width: 38px;
    height: 38px;
    padding: 0;
    border-radius: 10px;
    background: transparent;
    border: 1px solid var(--bg-border);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover:not(:disabled) {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   Inputs
   ============================================ */
.input {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--bg-border);
    color: var(--text-primary);
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-light);
}

.input::placeholder {
    color: var(--text-tertiary);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.2px;
}

.field-error {
    color: var(--danger);
    font-size: 12px;
    margin-top: 2px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--bg-border);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--shadow-card);
}

/* ============================================
   Avatar
   ============================================ */
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent-primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

/* ============================================
   Blazor error UI
   ============================================ */
#blazor-error-ui {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--color-pink-100);
    color: var(--color-pink-900);
    padding: 12px 20px;
    display: none;
    z-index: 1000;
    border-top: 1px solid var(--color-pink-200);
    font-size: 13px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
    font-size: 18px;
    line-height: 1;
}

.valid.modified:not([type=checkbox]) { outline: 1px solid var(--color-green-400); }
.invalid { outline: 1px solid var(--danger); }
.validation-message { color: var(--danger); font-size: 12px; }

/* ============================================
   Workspace — Zurück-Buttons nur in der Single-Pane-Ansicht (< 900 px).
   Liegt global (nicht scoped), weil die Buttons in Kind-Komponenten
   des WorkspaceLayout stecken und die Regel die Scope-Grenze kreuzen muss.
   ============================================ */
@media (min-width: 900px) {
    .ws .back-btn { display: none; }
}

/* Tablet (900–1279 px): 2-spaltig. Sobald ein Dings/eine Datei fokussiert ist,
   blendet das Layout die Container-Liste (col1) aus und zeigt Geräte-Panel (col2)
   + Detail (col3). Damit man wieder zur Container-Übersicht kommt, bekommt das
   Geräte-Panel hier seinen Zurück-Pfeil zurück — analog zur einspaltigen Ansicht. */
@media (min-width: 900px) and (max-width: 1279px) {
    .ws.ws-focus-dings .ws-col-2 .back-btn,
    .ws.ws-focus-file .ws-col-2 .back-btn { display: inline-flex; }
}
