/* ============================================================
   DOCUMENTATION MODULE — Contract Box Realty
   ============================================================ */

/* Developer inner tab bar */
.doc-dev-tabs { margin-top: -8px; padding-left: 8px; }
.doc-dev-tabs .sub-tab-btn { font-size: 12px; padding: 4px 12px; }

/* Loading / Error states */
.doc-loading  { text-align: center; padding: 40px; color: var(--text-muted); font-size: 16px; }
.doc-error    { text-align: center; padding: 40px; color: #dc3545; font-size: 16px; }
.doc-loading-sm { color: var(--text-muted); font-size: 13px; padding: 10px; }
.doc-error-sm   { color: #dc3545; font-size: 13px; padding: 10px; }
.doc-no-data    { color: var(--text-muted); font-size: 13px; font-style: italic; padding: 8px 0; }

/* Search bar */
.doc-search-bar { margin-bottom: 16px; }
.doc-search-bar input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    background: var(--bg-card);
    color: var(--text-primary);
}
.doc-search-bar input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.15);
}

/* ============================================================
   OVERVIEW — Stats cards
   ============================================================ */
.doc-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.doc-stat-card {
    flex: 1;
    min-width: 110px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}
.doc-stat-number { font-size: 28px; font-weight: 700; color: var(--accent); }
.doc-stat-label  { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }

.doc-system-desc {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
}
.doc-system-desc h3 { margin: 0 0 8px; font-size: 16px; }
.doc-system-desc p  { margin: 0; color: var(--text-secondary); line-height: 1.5; }

/* Quick-link cards */
.doc-quicklinks h3 { margin: 0 0 12px; font-size: 16px; }
.doc-quicklink-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.doc-quicklink-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.doc-quicklink-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0, 122, 255, 0.12); }
.doc-quicklink-icon  { font-size: 24px; margin-bottom: 8px; }
.doc-quicklink-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.doc-quicklink-desc  { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* ============================================================
   FILTER BAR
   ============================================================ */
.doc-filter-bar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.doc-filter-btn {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg-card);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}
.doc-filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.doc-filter-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ============================================================
   MODULES — Card grid
   ============================================================ */
.doc-module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.doc-module-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    cursor: pointer;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.doc-module-card:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0, 122, 255, 0.1); }
.doc-module-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.doc-module-name { font-weight: 600; font-size: 15px; }
.doc-module-path { font-size: 11px; color: var(--text-muted); font-family: monospace; margin-bottom: 6px; word-break: break-all; }
.doc-module-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 8px; }
.doc-module-meta { display: flex; gap: 10px; font-size: 11px; color: var(--text-muted); }
.doc-status-active    { color: #2e7d32; }
.doc-status-completed { color: #2e7d32; }
.doc-status-planning  { color: #e65100; }
.doc-status-archived  { color: var(--text-muted); }

/* Module detail expand */
.doc-module-detail { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.doc-module-detail.open { max-height: 2000px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.doc-detail-section { margin-bottom: 12px; }
.doc-detail-section h4 { margin: 0 0 6px; font-size: 13px; }
.doc-detail-section ul { margin: 0; padding-left: 20px; font-size: 13px; }
.doc-detail-section li { margin-bottom: 4px; color: var(--text-secondary); }

/* ============================================================
   TYPE BADGES
   ============================================================ */
.doc-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
}
.doc-type-backend    { background: #e8f5e9; color: #2e7d32; }
.doc-type-frontend   { background: #e3f2fd; color: #1565c0; }
.doc-type-service    { background: #f3e5f5; color: #7b1fa2; }
.doc-type-component  { background: #fff3e0; color: #e65100; }
.doc-type-database   { background: #e8eaf6; color: #283593; }
.doc-type-controller { background: #fce4ec; color: #c62828; }
.doc-type-module     { background: #e3f2fd; color: #1565c0; }
.doc-type-convention { background: #f5f5f5; color: #616161; }

/* ============================================================
   API REFERENCE — Endpoints
   ============================================================ */
.doc-api-group { margin-bottom: 20px; }
.doc-api-group-header { font-size: 15px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.doc-endpoint-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 13px;
    transition: background 0.15s;
}
.doc-endpoint-row:hover { background: var(--bg-hover); }
.doc-endpoint-path { font-family: monospace; font-size: 12px; white-space: nowrap; }
.doc-endpoint-desc { color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* HTTP method badges */
.doc-method-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    min-width: 52px;
    text-align: center;
    flex-shrink: 0;
}
.doc-method-get    { background: #d4edda; color: #155724; }
.doc-method-post   { background: #cce5ff; color: #004085; }
.doc-method-put    { background: #fff3cd; color: #856404; }
.doc-method-patch  { background: #e2e3e5; color: #383d41; }
.doc-method-delete { background: #f8d7da; color: #721c24; }

.doc-auth-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--bg-hover);
    color: var(--text-muted);
    flex-shrink: 0;
}

/* ============================================================
   PATTERNS
   ============================================================ */
.doc-pattern-group { margin-bottom: 24px; }
.doc-pattern-group-header { font-size: 15px; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); text-transform: capitalize; }
.doc-pattern-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.doc-pattern-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.doc-pattern-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.doc-pattern-name   { font-weight: 600; font-size: 14px; }
.doc-pattern-desc   { font-size: 13px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 8px; }
.doc-pattern-when   { font-size: 12px; color: var(--text-muted); background: var(--bg-hover); padding: 8px 10px; border-radius: 6px; margin-bottom: 8px; }

/* Code blocks */
.doc-code-block {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 12px;
    overflow-x: auto;
    margin: 8px 0 0;
    line-height: 1.5;
}
.doc-code-block code { font-family: 'SF Mono', 'Monaco', 'Menlo', monospace; white-space: pre; }

/* ============================================================
   GOTCHAS
   ============================================================ */
.doc-gotcha-group { margin-bottom: 24px; }
.doc-gotcha-group-header { font-size: 15px; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.doc-gotcha-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    margin-bottom: 10px;
}
.doc-gotcha-card.doc-severity-critical { border-left-color: #dc3545; }
.doc-gotcha-card.doc-severity-warning  { border-left-color: #ffc107; }
.doc-gotcha-card.doc-severity-info     { border-left-color: #17a2b8; }
.doc-gotcha-header { margin-bottom: 8px; }
.doc-severity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}
.doc-severity-badge.doc-severity-critical { background: #f8d7da; color: #721c24; }
.doc-severity-badge.doc-severity-warning  { background: #fff3cd; color: #856404; }
.doc-severity-badge.doc-severity-info     { background: #d1ecf1; color: #0c5460; }
.doc-gotcha-mistake, .doc-gotcha-correct  { font-size: 13px; line-height: 1.5; margin-bottom: 6px; color: var(--text-secondary); }
.doc-gotcha-examples summary { cursor: pointer; font-size: 12px; color: var(--accent); font-weight: 500; }
.doc-example-label              { font-size: 11px; font-weight: 600; color: #dc3545; text-transform: uppercase; margin: 8px 0 4px; }
.doc-example-correct-label      { color: #28a745; }

/* ============================================================
   USER GUIDE
   ============================================================ */
.doc-user-guide { display: flex; flex-direction: column; gap: 10px; }

.doc-guide-module {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    overflow: hidden;
}
.doc-guide-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s;
}
.doc-guide-header:hover { background: var(--bg-hover); }
.doc-guide-title { display: flex; align-items: center; gap: 10px; }
.doc-guide-icon  { font-size: 22px; line-height: 1; }
.doc-guide-title h3 { margin: 0; font-size: 15px; font-weight: 600; }
.doc-guide-toggle { font-size: 12px; color: var(--text-muted); transition: transform 0.2s; }
.doc-guide-module.expanded .doc-guide-toggle { transform: rotate(90deg); }

.doc-guide-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; padding: 0 16px; }
.doc-guide-module.expanded .doc-guide-body { max-height: 5000px; padding: 0 16px 16px; border-top: 1px solid var(--border); }

.doc-guide-overview { font-size: 13px; color: var(--text-muted); font-style: italic; margin: 12px 0; line-height: 1.5; }

.doc-guide-section { margin-bottom: 6px; }
.doc-guide-section summary {
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 0;
    list-style: none;
}
.doc-guide-section summary::-webkit-details-marker { display: none; }
.doc-guide-section summary::before { content: '\25B6'; display: inline-block; margin-right: 8px; font-size: 10px; transition: transform 0.2s; }
.doc-guide-section[open] summary::before { transform: rotate(90deg); }
.doc-guide-section summary:hover { color: var(--accent); }

.doc-guide-content {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 4px 0 8px 18px;
    border-left: 2px solid var(--border);
    margin-left: 4px;
}
.doc-guide-content ol, .doc-guide-content ul { margin: 6px 0; padding-left: 20px; }
.doc-guide-content li  { margin-bottom: 4px; }
.doc-guide-content p   { margin: 6px 0; }

/* ============================================================
   DARK MODE overrides (supplement CSS variables)
   ============================================================ */
@media (prefers-color-scheme: dark) {
    .doc-type-backend    { background: #1a2e1a; color: #66bb6a; }
    .doc-type-frontend   { background: #102030; color: #4fc3f7; }
    .doc-type-service    { background: #1e1030; color: #ce93d8; }
    .doc-type-component  { background: #2e2010; color: #ffa726; }
    .doc-type-database   { background: #10102e; color: #9fa8da; }
    .doc-type-controller { background: #2e1020; color: #f48fb1; }
    .doc-type-module     { background: #102030; color: #4fc3f7; }
    .doc-type-convention { background: #2a2a2a; color: #aaa; }

    .doc-method-get    { background: #1a2e1a; color: #66bb6a; }
    .doc-method-post   { background: #102030; color: #4fc3f7; }
    .doc-method-put    { background: #2e2a10; color: #ffd54f; }
    .doc-method-patch  { background: #2a2a2a; color: #bbb; }
    .doc-method-delete { background: #2e1a1a; color: #ef5350; }

    .doc-severity-badge.doc-severity-critical { background: #2e0a0a; color: #ef5350; }
    .doc-severity-badge.doc-severity-warning  { background: #2e2010; color: #ffa726; }
    .doc-severity-badge.doc-severity-info     { background: #102030; color: #4fc3f7; }

    .doc-status-active, .doc-status-completed { color: #66bb6a; }
    .doc-status-planning { color: #ffa726; }
}
