/* =========================================
   LEX — LEGAL VOICE PLATFORM
   Components: components.css
   ========================================= */

/* ---- Documents Grid / List ---- */
.documents-grid {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    align-content: start;
}

.documents-grid.list-view {
    grid-template-columns: 1fr;
    gap: 8px;
    max-width: 800px;
}

.doc-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: 20px;
    cursor: pointer;
    transition: all var(--t-med);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.doc-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), transparent);
    opacity: 0;
    transition: opacity var(--t-fast);
}

.doc-card:hover {
    background: var(--bg-card);
    border-color: rgba(15, 23, 42, 0.12);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.doc-card:hover::before {
    opacity: 1;
}

.doc-card-icon {
    width: 40px;
    height: 40px;
    background: var(--gold-dim);
    border: 1px solid var(--border-gold);
    border-radius: var(--r-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
}

.doc-card-title {
    font-family: var(--font-doc);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.doc-card-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doc-card-date {
    font-size: 11px;
    color: var(--text-muted);
}

.doc-card-words {
    font-size: 11px;
    color: var(--text-muted);
}

.doc-card-actions {
    display: flex;
    gap: 6px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

/* List view card */
.list-view .doc-card {
    flex-direction: row;
    align-items: center;
    padding: 14px 18px;
    gap: 14px;
    border-radius: var(--r-md);
}

.list-view .doc-card-icon {
    flex-shrink: 0;
}

.list-view .doc-card-title {
    flex: 1;
    -webkit-line-clamp: 1;
}

.list-view .doc-card-meta {
    flex-direction: row;
    gap: 16px;
    margin-left: auto;
}

.list-view .doc-card-actions {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-left: 0;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 16px;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.empty-state svg {
    opacity: 0.3;
}

.empty-state h3 {
    font-family: var(--font-doc);
    font-size: 20px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 13px;
    max-width: 280px;
}

/* ---- Templates ---- */
.templates-grid {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    align-content: start;
}

.template-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--t-med);
    display: flex;
    flex-direction: column;
}

.template-card:hover {
    border-color: var(--border-gold);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), 0 0 20px rgba(180, 83, 9, 0.15);
}

.template-card-header {
    padding: 20px;
    background: var(--bg-card);
    display: flex;
    align-items: flex-start;
    gap: 14px;
    border-bottom: 1px solid var(--border);
}

.template-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--r-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 20px;
}

.template-card-title {
    font-family: var(--font-doc);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 4px;
}

.template-card-category {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.template-card-body {
    padding: 14px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.template-card-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.template-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: auto;
}

.template-tag {
    background: rgba(180, 83, 9, 0.06);
    border: 1px solid rgba(180, 83, 9, 0.2);
    color: #92400E;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: var(--r-sm);
    font-weight: 500;
}

.template-card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.template-pages {
    font-size: 11px;
    color: var(--text-muted);
}

/* ---- Vocabulary ---- */
.vocab-layout {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.vocab-categories {
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    background: var(--bg-panel);
    overflow-y: auto;
    padding: 12px 8px;
}

.vocab-cat-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 9px 12px;
    background: transparent;
    border: none;
    border-radius: var(--r-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: all var(--t-fast);
    font-family: var(--font-ui);
    margin-bottom: 2px;
}

.vocab-cat-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.vocab-cat-btn.active {
    background: var(--gold-dim);
    color: var(--gold-light);
    border: 1px solid var(--border-gold);
}

.vocab-cat-count {
    font-size: 10px;
    background: var(--bg-hover);
    padding: 1px 6px;
    border-radius: 999px;
    color: var(--text-muted);
}

.vocab-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vocab-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 12px 0 6px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}

.vocab-item {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 12px 16px;
    cursor: pointer;
    transition: all var(--t-fast);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vocab-item:hover {
    background: var(--bg-card);
    border-color: var(--border-gold);
}

.vocab-item-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.vocab-item-text {
    font-family: var(--font-doc);
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vocab-item-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

/* Quick insert rail items */
.rail-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    padding: 8px 10px;
    cursor: pointer;
    transition: all var(--t-fast);
    margin-bottom: 4px;
    font-size: 11.5px;
    color: var(--text-secondary);
    line-height: 1.4;
}

.rail-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-gold);
    color: var(--text-primary);
}

.rail-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 4px 4px;
}

/* ---- Voice Commands ---- */
.commands-layout {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 800px;
}

.commands-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.command-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 18px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    transition: all var(--t-fast);
}

.command-card:hover {
    border-color: rgba(15, 23, 42, 0.12);
}

.command-trigger-wrap {
    flex: 1;
}

.command-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.command-trigger-badge {
    background: var(--gold-dim);
    border: 1px solid var(--border-gold);
    color: var(--gold-light);
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.command-action-text {
    font-size: 12.5px;
    color: var(--text-muted);
    font-family: var(--font-mono);
    line-height: 1.5;
    background: var(--bg-card);
    padding: 6px 10px;
    border-radius: var(--r-sm);
    margin-top: 6px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.command-type {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 999px;
}

.command-type.system {
    background: var(--blue-dim);
    color: var(--blue-accent);
    border: 1px solid rgba(30, 58, 138, 0.3);
}

.command-type.custom {
    background: var(--gold-dim);
    color: var(--gold-light);
    border: 1px solid var(--border-gold);
}

/* ---- Settings ---- */
.settings-layout {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 640px;
    width: 100%;
    margin: 0 auto;
}

.settings-section {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    overflow: hidden;
    flex-shrink: 0;
}

.settings-section-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
}

.settings-section-title {
    font-family: var(--font-doc);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-section-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
    gap: 16px;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-label {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.settings-item-desc {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-hover);
    border-radius: 999px;
    cursor: pointer;
    transition: var(--t-fast);
    border: 1px solid var(--border);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: var(--t-med);
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--gold-dim);
    border-color: var(--border-gold);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
    background: var(--gold);
}

/* Settings select */
.settings-select {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    color: var(--text-primary);
    font-size: 13px;
    font-family: var(--font-ui);
    padding: 7px 12px;
    outline: none;
    min-width: 160px;
    transition: border-color var(--t-fast);
}

.settings-select:focus {
    border-color: var(--border-gold);
}

/* Profile Card */
.voice-profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-gold);
    border-radius: var(--r-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 16px 20px;
}

.vp-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #92400E);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.vp-info {
    flex: 1;
}

.vp-name {
    font-family: var(--font-doc);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 3px;
}

.vp-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.vp-accuracy {
    text-align: right;
}

.vp-accuracy-num {
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-doc);
    color: var(--gold);
    line-height: 1;
}

.vp-accuracy-label {
    font-size: 11px;
    color: var(--text-muted);
}

/* Progress bar */
.progress-bar {
    height: 4px;
    background: var(--bg-hover);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 2px;
    transition: width var(--t-slow);
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--border);
    border-radius: var(--r-md);
    overflow: hidden;
    margin: 0 20px 16px;
}

.stat-item {
    background: var(--bg-elevated);
    padding: 14px 16px;
    text-align: center;
}

.stat-value {
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-doc);
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}