/* ═══════════════════════════════════════════════════════════
   HEXAGON MONITOR — Dashboard
   Requires: common.css
   ═══════════════════════════════════════════════════════════ */

/* ─── Header (dashboard extensions) ───────────────────── */

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.client-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--fg);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-header {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--border);
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    font-family: inherit;
    color: var(--fg);
    transition: all 0.2s;
    text-decoration: none;
}

.btn-header:hover {
    border-color: var(--fg);
    background: var(--fg);
    color: var(--bg);
}

/* ─── Nav Tabs ────────────────────────────────────────── */

nav {
    display: flex;
    gap: 0;
    margin-bottom: 40px;
    border-bottom: 1px solid var(--border);
}

nav button {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 12px 20px;
    font-size: 13px;
    font-family: inherit;
    color: var(--gray);
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s;
}

nav button.active {
    color: var(--fg);
    border-bottom-color: var(--fg);
    font-weight: 500;
}

nav button:hover {
    color: var(--fg);
}

/* ─── Forms ───────────────────────────────────────────── */

.field {
    margin-bottom: 24px;
}

.field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--fg);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    color: var(--fg);
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--fg);
}

input::placeholder {
    color: #bbb;
}

/* ─── Color Picker ────────────────────────────────────── */

.color-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-row input[type="color"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 32px;
    height: 32px;
    border: 2px solid var(--border);
    border-radius: 50%;
    padding: 0;
    cursor: pointer;
    background: transparent;
    overflow: hidden;
}

.color-row input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-row input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 50%;
}

.color-row input[type="color"]::-moz-color-swatch {
    border: none;
    border-radius: 50%;
}

.color-hex {
    font-size: 13px;
    color: var(--gray);
    font-family: monospace;
}

/* ─── Login ───────────────────────────────────────────── */

#login-view {
    display: flex;
    flex-direction: column;
    min-height: 70vh;
}

.login-form {
    width: 100%;
    max-width: 520px;
    margin: auto auto;
    position: relative;
}

.login-error {
    font-size: 13px;
    color: var(--red);
    margin-top: 12px;
    position: absolute;
    left: 0;
    right: 0;
}

/* ─── Dashboard ───────────────────────────────────────── */

#dash-view {
    display: none;
    padding-bottom: 80px;
}

/* ─── Preview Card ────────────────────────────────────── */

.preview-card {
    border: 1px solid var(--border);
    padding: 16px;
    margin-top: 24px;
}

.preview-label {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--gray);
    margin-bottom: 12px;
}

.embed-preview {
    border-left: 4px solid var(--accent);
    padding: 12px 16px;
    background: #f0f0f0;
}

.embed-preview .ep-title {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.embed-preview .ep-desc {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 8px;
}

.embed-preview .ep-fields {
    margin-bottom: 8px;
}

.embed-preview .ep-field {
    display: flex;
    gap: 8px;
    font-size: 12px;
}

.embed-preview .ep-field-name {
    font-weight: 500;
}

.embed-preview .ep-field-value {
    color: var(--gray);
}

.embed-preview .ep-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--muted);
}

.embed-preview .ep-footer img {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    object-fit: cover;
}

/* ─── Test Section ────────────────────────────────────── */

.test-section {
    margin-top: 48px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.test-desc {
    font-size: 13px;
    color: var(--gray);
    margin-bottom: 20px;
}

/* ─── Toolbar ─────────────────────────────────────────── */

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.toolbar .search-bar {
    flex: 1;
    margin-bottom: 0;
}

.toolbar .search-bar input {
    width: 100%;
}

.toolbar-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.import-label {
    cursor: pointer;
}

/* ─── Filters ─────────────────────────────────────────── */

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.tag-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-btn,
.sub-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    background: transparent;
    font-size: 12px;
    font-family: inherit;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.2s;
}

.tag-btn.active,
.sub-btn.active {
    border-color: var(--fg);
    color: var(--fg);
    font-weight: 500;
}

.tag-btn:hover,
.sub-btn:hover {
    border-color: var(--fg);
    color: var(--fg);
}

.sub-filters {
    display: flex;
    gap: 8px;
}

.site-count {
    font-size: 12px;
    color: var(--gray);
    margin-bottom: 16px;
}

/* ─── Sites List ──────────────────────────────────────── */

.site-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.site-item {
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 16px 20px;
}

.site-item:last-child {
    border-bottom: 1px solid var(--border);
}

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.site-info {
    flex: 1;
    min-width: 0;
}

.site-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.site-name a {
    color: var(--fg);
    text-decoration: none;
}

.site-name a:hover {
    text-decoration: underline;
}

.site-tag {
    font-size: 12px;
    font-weight: 400;
    color: var(--gray);
    letter-spacing: 0.5px;
}

.site-status {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.status-label {
    font-size: 11px;
    color: var(--gray);
}

.status-label.deactive {
    color: var(--red);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.active   { background: var(--green); }
.status-dot.inactive { background: var(--red); }
.status-dot.warning  { background: var(--yellow); }
.status-dot.none     { background: var(--border); }

/* ─── Site Actions ────────────────────────────────────── */

.site-actions {
    margin-top: 12px;
    display: none;
}

.site-item.expanded .site-actions {
    display: block;
}

.site-actions-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.webhook-display {
    font-size: 12px;
    color: var(--gray);
    word-break: break-all;
    font-family: monospace;
    margin-top: 4px;
    line-height: 1.4;
}

.webhook-edit {
    margin-top: 8px;
}

.webhook-edit input {
    font-size: 13px;
    padding: 10px 12px;
}

.webhook-input {
    margin-top: 8px;
}

.disabled-msg {
    font-size: 12px;
    color: var(--red);
    margin-top: 4px;
}

.last-sent-info {
    font-size: 11px;
    color: var(--gray);
    margin-top: 4px;
}

/* ─── Toast ───────────────────────────────────────────── */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    background: var(--fg);
    color: var(--bg);
    font-size: 13px;
    font-family: inherit;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
}

/* ─── Loading ─────────────────────────────────────────── */

.loading {
    text-align: center;
    padding: 40px 0;
    color: var(--gray);
    font-size: 13px;
}

/* ─── Responsive (dashboard-specific) ─────────────────── */

@media (min-width: 480px) {
    nav button {
        padding: 12px 24px;
        font-size: 14px;
    }

    .filter-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .toolbar {
        flex-direction: column;
    }

    .toolbar-actions {
        width: 100%;
    }

    .toolbar-actions .btn-sm {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 380px) {
    nav button {
        padding: 10px 14px;
        font-size: 12px;
    }
}

/* ─── Skeleton Loading ────────────────────────────────── */

.skeleton-row {
    height: 54px;
    border: 1px solid var(--border);
    border-bottom: none;
    background: linear-gradient(90deg, transparent 25%, var(--border) 50%, transparent 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

.skeleton-row:last-child {
    border-bottom: 1px solid var(--border);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ─── Button Spinner ──────────────────────────────────── */

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--fg);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

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

/* ─── Dark Mode (Dashboard) ──────────────────────────── */

/* ─── Dark Mode (Dashboard) ──────────────────────────── */

html.dark .embed-preview {
    background: #1e1e1e;
}

html.dark .color-row input[type="color"] {
    border-color: #444;
}

html.dark .btn-header {
    color: var(--fg);
    border-color: var(--border);
}

html.dark .btn-header:hover {
    border-color: var(--fg);
    background: var(--fg);
    color: var(--bg);
}

html.dark .skeleton-row {
    background: linear-gradient(90deg, transparent 25%, #2a2a2a 50%, transparent 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
}

html.dark .btn-spinner {
    border-color: #444;
    border-top-color: var(--fg);
}
