/* ── NICC Style Config ─ Glassmorphism Theme ── */

:root {
    --nsc-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --nsc-card-bg: rgba(255,255,255,0.92);
    --nsc-card-border: rgba(255,255,255,0.3);
    --nsc-text: #1e293b;
    --nsc-text-muted: #64748b;
    --nsc-accent: #6366f1;
    --nsc-accent-light: #818cf8;
    --nsc-success: #10b981;
    --nsc-danger: #ef4444;
    --nsc-warn: #f59e0b;
    --nsc-info: #3b82f6;
    --nsc-shadow: 0 8px 32px rgba(31,38,135,0.15);
    --nsc-radius: 12px;
    --nsc-radius-sm: 8px;
    --nsc-font: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ── App Container ── */

#niccstyle-app {
    font-family: var(--nsc-font);
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem;
    color: var(--nsc-text);
}

/* ── Header ── */

.nsc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--nsc-card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--nsc-card-border);
    border-radius: var(--nsc-radius);
    box-shadow: var(--nsc-shadow);
    margin-bottom: 1rem;
}

.nsc-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nsc-header-left svg { color: var(--nsc-accent); }

.nsc-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    color: var(--nsc-text);
}

/* ── Tabs ── */

.nsc-tabs {
    display: flex;
    gap: 0;
    background: var(--nsc-card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--nsc-card-border);
    border-radius: var(--nsc-radius);
    box-shadow: var(--nsc-shadow);
    overflow: hidden;
    margin-bottom: 1rem;
}

.nsc-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    font-family: var(--nsc-font);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--nsc-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.nsc-tab:hover { color: var(--nsc-accent); background: rgba(99,102,241,0.05); }
.nsc-tab.active { color: var(--nsc-accent); border-bottom-color: var(--nsc-accent); background: rgba(99,102,241,0.08); }

/* ── Panels ── */

.nsc-panel { animation: nscFadeIn 0.2s ease; }
@keyframes nscFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ── Cards ── */

.nsc-card {
    background: var(--nsc-card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--nsc-card-border);
    border-radius: var(--nsc-radius);
    box-shadow: var(--nsc-shadow);
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.nsc-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    color: var(--nsc-text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ── Toolbar ── */

.nsc-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.nsc-toolbar-compact { margin-bottom: 0.5rem; }
.nsc-toolbar-label { font-weight: 600; font-size: 0.875rem; }

/* ── Forms ── */

.nsc-input, .nsc-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--nsc-radius-sm);
    font-family: var(--nsc-font);
    font-size: 0.875rem;
    transition: border-color 0.2s;
    background: #fff;
    color: var(--nsc-text);
}

.nsc-input:focus, .nsc-select:focus { outline: none; border-color: var(--nsc-accent); box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }
.nsc-filter { flex: 1; min-width: 150px; }

.nsc-form-row { display: flex; gap: 1rem; margin-bottom: 0.75rem; }
.nsc-form-group { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.nsc-form-group label { font-size: 0.8rem; font-weight: 600; color: var(--nsc-text-muted); }
.nsc-form-color { flex: 0 0 80px; }
.nsc-form-color input[type=color] { width: 100%; height: 36px; border: 1px solid #e2e8f0; border-radius: var(--nsc-radius-sm); cursor: pointer; padding: 2px; }
.nsc-form-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }

/* ── Buttons ── */

.nsc-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--nsc-radius-sm);
    font-family: var(--nsc-font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
    color: var(--nsc-text);
    white-space: nowrap;
}

.nsc-btn:hover { border-color: var(--nsc-accent); color: var(--nsc-accent); }
.nsc-btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

.nsc-btn-danger { background: var(--nsc-danger); color: #fff; border-color: var(--nsc-danger); }
.nsc-btn-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }

.nsc-btn-ghost { background: transparent; border-color: transparent; color: var(--nsc-text-muted); }
.nsc-btn-ghost:hover { color: var(--nsc-text); }

.nsc-btn-sm { padding: 0.3rem 0.6rem; font-size: 0.75rem; }
.nsc-btn-danger-sm { color: var(--nsc-danger); border-color: var(--nsc-danger); background: transparent; }
.nsc-btn-danger-sm:hover { background: var(--nsc-danger); color: #fff; }

.nsc-btn-block { width: 100%; justify-content: center; }

/* ── Badges ── */

.nsc-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.6rem;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #f1f5f9;
    color: var(--nsc-text-muted);
}

.nsc-badge-sm { padding: 0.1rem 0.4rem; font-size: 0.7rem; }
.nsc-badge-origin { background: var(--nsc-accent); color: #fff; }
.nsc-badge-info { background: rgba(59,130,246,0.1); color: var(--nsc-info); }
.nsc-badge-ok { background: rgba(16,185,129,0.1); color: var(--nsc-success); }
.nsc-badge-error { background: rgba(239,68,68,0.1); color: var(--nsc-danger); }
.nsc-badge-warn { background: rgba(245,158,11,0.1); color: var(--nsc-warn); }
.nsc-badge-template { background: rgba(99,102,241,0.1); color: var(--nsc-accent); }

/* ── Dots (status indicators) ── */

.nsc-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.nsc-dot-ok { background: var(--nsc-success); }
.nsc-dot-no { background: #cbd5e1; }

/* ── Color dot (group) ── */

.nsc-color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Tables ── */

.nsc-table-wrap { overflow-x: auto; }

.nsc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.nsc-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 700;
    color: var(--nsc-text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.nsc-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.nsc-table tr:hover td { background: rgba(99,102,241,0.03); }
.nsc-log-details { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.7rem; color: var(--nsc-text-muted); }
.nsc-empty { text-align: center; padding: 2rem; color: var(--nsc-text-muted); font-style: italic; }

/* ── Groups Grid ── */

.nsc-groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.nsc-group-card {
    background: var(--nsc-card-bg);
    border: 1px solid var(--nsc-card-border);
    border-radius: var(--nsc-radius);
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: box-shadow 0.2s, transform 0.2s;
}

.nsc-group-card:hover { box-shadow: var(--nsc-shadow); transform: translateY(-2px); }

.nsc-group-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.nsc-group-header strong { flex: 1; font-size: 0.95rem; }

.nsc-group-desc { font-size: 0.8rem; color: var(--nsc-text-muted); margin: 0 0 0.5rem 0; }

.nsc-group-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--nsc-text-muted);
    margin-bottom: 0.75rem;
}

.nsc-group-actions { display: flex; gap: 0.5rem; }

/* ── Switch Toggle ── */

.nsc-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.nsc-switch input { opacity: 0; width: 0; height: 0; }

.nsc-switch-slider {
    position: absolute;
    inset: 0;
    background: #cbd5e1;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.nsc-switch-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.nsc-switch input:checked + .nsc-switch-slider { background: var(--nsc-success); }
.nsc-switch input:checked + .nsc-switch-slider::before { transform: translateX(16px); }

/* ── Assignments Layout ── */

.nsc-assign-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .nsc-assign-layout { grid-template-columns: 1fr; }
}

/* ── Checklist ── */

.nsc-check-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: var(--nsc-radius-sm);
    padding: 0.5rem;
    margin-bottom: 0.75rem;
}

.nsc-check-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.nsc-check-item:hover { background: rgba(99,102,241,0.05); }
.nsc-check-item input[type=checkbox] { accent-color: var(--nsc-accent); }

/* ── Color Preview ── */

.nsc-color-preview {
    margin-top: 1rem;
    padding: 0.75rem;
    background: #f8fafc;
    border-radius: var(--nsc-radius-sm);
}

.nsc-color-preview h4 { font-size: 0.8rem; margin: 0 0 0.5rem 0; color: var(--nsc-text-muted); }

.nsc-swatches { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.nsc-swatch {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.nsc-swatch-color {
    display: block;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid rgba(0,0,0,0.1);
}

.nsc-swatch small { font-size: 0.6rem; color: var(--nsc-text-muted); max-width: 50px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Apply Section ── */

.nsc-apply-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f5f9;
}

.nsc-apply-row:last-child { border-bottom: none; }
.nsc-apply-row .nsc-text-muted { flex: 1; }

/* ── Progress Bar ── */

.nsc-progress {
    height: 6px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin: 1rem 0 0.5rem;
}

.nsc-progress-bar {
    height: 100%;
    background: var(--nsc-accent);
    border-radius: 6px;
    transition: width 0.5s ease;
    width: 0;
}

.nsc-apply-status { font-size: 0.85rem; font-weight: 600; color: var(--nsc-text); margin-bottom: 0.5rem; }

/* ── Loading / Spinner ── */

.nsc-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem;
    justify-content: center;
    color: var(--nsc-text-muted);
}

.nsc-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: var(--nsc-accent);
    border-radius: 50%;
    animation: nscSpin 0.7s linear infinite;
}

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

/* ── Password Gate ── */

.nsc-password-gate {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.nsc-card-password {
    max-width: 380px;
    width: 100%;
    text-align: center;
}

.nsc-card-password svg { margin-bottom: 1rem; }
.nsc-card-password h2 { font-size: 1.1rem; margin: 0 0 1rem 0; }

.nsc-alert { padding: 0.5rem 0.75rem; border-radius: var(--nsc-radius-sm); margin-bottom: 1rem; font-size: 0.85rem; font-weight: 600; }
.nsc-alert-error { background: rgba(239,68,68,0.1); color: var(--nsc-danger); }

.nsc-text-muted { color: var(--nsc-text-muted); }

/* ── Origin display ── */

.nsc-origin-display {
    padding: 0.5rem 0.75rem;
    background: #f8fafc;
    border-radius: var(--nsc-radius-sm);
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}
