/* ================================================================
   DESIGN TOKENS — Shared UI primitives for ECBT modals & panels
   Componentes base reutilizaveis: overlay, dialog, form, buttons,
   badges, tables, cards, loading, filters.

   Cada modal/painel usa classes .ecbt-* como base e adiciona
   classes especificas do componente (.photolog-*, .credential-*, etc.)
   ================================================================ */

/* === OVERLAY === */
.ecbt-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

/* === DIALOG === */
.ecbt-dialog {
    background: var(--bg-secondary, #1e1e2e);
    border: 1px solid var(--border-color, #333);
    border-radius: 12px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    position: relative;
}
.ecbt-dialog--sm  { width: 100%; max-width: 480px; }
.ecbt-dialog--md  { width: 100%; max-width: 520px; }
.ecbt-dialog--lg  { width: 100%; max-width: 720px; }
.ecbt-dialog--xl  { width: 100%; max-width: 900px; }

/* === HEADER === */
.ecbt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #333);
}

.ecbt-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #e0e0e0);
}

.ecbt-close {
    background: none;
    border: none;
    color: var(--text-secondary, #888);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.ecbt-close:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.08));
    color: var(--text-primary, #e0e0e0);
}

/* === FORM === */
.ecbt-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.ecbt-field label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary, #aaa);
}

.ecbt-field select,
.ecbt-field textarea,
.ecbt-field input[type="text"],
.ecbt-field input[type="number"],
.ecbt-field input[type="email"],
.ecbt-field input[type="url"],
.ecbt-field input[type="password"] {
    background: var(--bg-primary, #121220);
    border: 1px solid var(--border-color, #333);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
}

.ecbt-field select:focus,
.ecbt-field textarea:focus,
.ecbt-field input:focus {
    border-color: var(--accent, #60a5fa);
    outline: none;
}

.ecbt-hint {
    font-size: 11px;
    color: var(--text-tertiary, #666);
}

/* === BUTTONS === */
.ecbt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 8px;
}

.ecbt-btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border-color, #333);
    transition: all 0.15s ease;
}

.ecbt-btn--primary {
    background: var(--accent, #60a5fa);
    color: #fff;
    border-color: var(--accent, #60a5fa);
}
.ecbt-btn--primary:hover { opacity: 0.9; }
.ecbt-btn--primary:disabled { opacity: 0.5; cursor: not-allowed; }

.ecbt-btn--cancel {
    background: transparent;
    color: var(--text-secondary, #aaa);
}
.ecbt-btn--cancel:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.08));
}

.ecbt-btn--danger {
    background: var(--error, #ef4444);
    color: #fff;
    border-color: var(--error, #ef4444);
}
.ecbt-btn--danger:hover { background: #dc2626; }

.ecbt-btn--outline {
    background: var(--bg-primary, #121220);
    border: 1px dashed #555;
    color: var(--text-secondary, #aaa);
}
.ecbt-btn--outline:hover {
    border-color: var(--accent, #60a5fa);
    color: var(--accent, #60a5fa);
}

/* === BADGE === */
.ecbt-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.ecbt-badge--info    { background: rgba(96, 165, 250, 0.2); color: #60a5fa; }
.ecbt-badge--success { background: rgba(74, 222, 128, 0.2); color: #4ade80; }
.ecbt-badge--warning { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.ecbt-badge--danger  { background: rgba(248, 113, 113, 0.2); color: #f87171; }
.ecbt-badge--purple  { background: rgba(168, 85, 247, 0.2); color: #a855f7; }

/* === TABLE === */
.ecbt-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ecbt-table thead th {
    text-align: left;
    padding: 8px 6px;
    color: var(--text-secondary, #888);
    font-weight: 500;
    border-bottom: 1px solid var(--border-color, #333);
    position: sticky;
    top: 0;
    background: var(--bg-secondary, #1e1e2e);
}

.ecbt-table tbody tr { cursor: pointer; }
.ecbt-table tbody tr:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.04));
}

.ecbt-table td {
    padding: 8px 6px;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.05));
    color: var(--text-primary, #e0e0e0);
    vertical-align: top;
}

/* === LOADING (inside dialog) === */
.ecbt-loading {
    position: absolute;
    inset: 0;
    z-index: 2;
    background: var(--bg-secondary, #1e1e2e);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.ecbt-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color, #333);
    border-top-color: var(--accent, #60a5fa);
    border-radius: 50%;
    animation: ecbt-spin 0.7s linear infinite;
}

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

.ecbt-loading-text {
    font-size: 12px;
    color: var(--text-tertiary, #666);
    margin-top: 4px;
}

/* === FILTER BAR === */
.ecbt-filters {
    display: flex;
    gap: 8px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color, #333);
    flex-wrap: wrap;
    align-items: center;
}

.ecbt-filters select,
.ecbt-filters input {
    background: var(--bg-primary, #121220);
    border: 1px solid var(--border-color, #333);
    border-radius: 6px;
    color: var(--text-primary, #e0e0e0);
    padding: 6px 10px;
    font-size: 13px;
}

/* === DETAIL PANEL === */
.ecbt-detail {
    border-top: 1px solid var(--border-color, #333);
    padding: 16px 20px;
    max-height: 50vh;
    overflow-y: auto;
    background: var(--bg-primary, #121220);
}

/* === CARD GRID === */
.ecbt-card-grid {
    display: grid;
    gap: 12px;
    padding: 16px 20px;
}
.ecbt-card-grid--2 { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.ecbt-card-grid--3 { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

.ecbt-card {
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.ecbt-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-color: var(--accent, #60a5fa);
}

/* === CHECKBOX === */
.ecbt-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
}

/* === TEXT TRUNCATION === */
.ecbt-truncate {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === TWO-PANE LAYOUT === */
.ecbt-two-pane {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.ecbt-sidebar {
    width: 220px;
    min-width: 180px;
    border-right: 1px solid var(--border-color, #333);
    overflow-y: auto;
    background: var(--bg-primary, #121220);
}

.ecbt-sidebar-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary, #aaa);
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.05));
}
.ecbt-sidebar-item:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.04));
}
.ecbt-sidebar-item--active {
    background: var(--accent, #3b6bff);
    color: #fff;
}

.ecbt-pane-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

/* === EMPTY STATE === */
.ecbt-empty {
    text-align: center;
    padding: 40px;
    color: var(--text-tertiary, #666);
    font-size: 13px;
}

/* === SECTION STAT TEXT === */
.ecbt-stat {
    font-size: 12px;
    color: var(--text-tertiary, #666);
    margin-left: auto;
}
