/* ═══════════════════════════════════════════════════════════
   Task Template Management Styles
   ═══════════════════════════════════════════════════════════ */

/* ── Page layout ── */
.tt-page { max-width: 1200px; margin: 0 auto; padding: 28px 32px; }
.tt-page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.tt-page-header-left h1 { font-size: 22px; font-weight: 700; color: #1a1a1a; margin-bottom: 4px; }
.tt-page-header-left p { font-size: 13px; color: #888; }

/* ── Buttons ── */
.tt-btn {
    padding: 9px 18px; border-radius: 8px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.15s; font-family: inherit; border: none;
    display: inline-flex; align-items: center; gap: 6px;
}
.tt-btn-primary { background: #2962FF; color: #fff; }
.tt-btn-primary:hover { background: #1e4fcc; }
.tt-btn-primary:disabled { background: #c5cfe6; cursor: not-allowed; }
.tt-btn-secondary { background: #fff; color: #555; border: 1px solid #ddd; }
.tt-btn-secondary:hover { background: #f5f5f5; }
.tt-btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Toolbar ── */
.tt-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.tt-search-box { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.tt-search-input {
    width: 100%; padding: 9px 14px 9px 38px; border: 1.5px solid #d0d5dd;
    border-radius: 8px; font-size: 13px; outline: none; transition: border-color 0.15s; font-family: inherit;
}
.tt-search-input:focus { border-color: #2962FF; box-shadow: 0 0 0 3px rgba(41,98,255,0.08); }
.tt-search-input::placeholder { color: #bbb; }
.tt-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #bbb; font-size: 14px; pointer-events: none; }
.tt-toolbar-sep { width: 1px; height: 28px; background: #e0e0e0; }

/* ── Filter chips ── */
.tt-filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tt-chip {
    padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 500;
    color: #555; background: #fff; border: 1px solid #dde1e6;
    cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.tt-chip:hover { border-color: #90caf9; background: #f5f8ff; }
.tt-chip.active { background: #e8f0fe; border-color: #2962FF; color: #2962FF; font-weight: 600; }

/* ── View Toggle ── */
.tt-view-toggle { display: flex; background: #f0f1f3; border-radius: 6px; padding: 2px; }
.tt-view-btn {
    padding: 6px 10px; border: none; background: none; cursor: pointer;
    border-radius: 5px; font-size: 15px; color: #888; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.tt-view-btn.active { background: #fff; color: #2962FF; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

/* ── Grid View ── */
.tt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tt-grid.hidden { display: none; }

/* ── Card ── */
.tt-card {
    background: #fff; border: 1px solid #e4e7eb; border-radius: 12px;
    padding: 20px; cursor: pointer; transition: all 0.15s;
    display: flex; flex-direction: column; position: relative;
}
.tt-card:hover { border-color: #90caf9; box-shadow: 0 4px 16px rgba(41,98,255,0.08); transform: translateY(-1px); }
.tt-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.tt-card-category {
    font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 3px 8px; border-radius: 4px;
}
.tt-cat-onboarding { background: #e8f5e9; color: #2e7d32; }
.tt-cat-follow-up { background: #fff3e0; color: #e65100; }
.tt-cat-admin { background: #e3f2fd; color: #1565c0; }
.tt-cat-custom { background: #f3e5f5; color: #7b1fa2; }
.tt-card-fav {
    background: none; border: none; font-size: 18px; cursor: pointer; color: #ddd;
    transition: all 0.15s; padding: 0;
}
.tt-card-fav:hover { color: #ffb300; }
.tt-card-fav.active { color: #ffb300; }
.tt-card-title { font-size: 15px; font-weight: 600; color: #1a1a1a; margin-bottom: 6px; line-height: 1.3; }
.tt-card-desc {
    font-size: 12px; color: #888; line-height: 1.5; margin-bottom: 14px;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1;
}
.tt-card-meta { display: flex; gap: 12px; align-items: center; font-size: 11px; color: #aaa; margin-bottom: 10px; flex-wrap: wrap; }
.tt-card-meta-item { display: flex; align-items: center; gap: 4px; }

.tt-card-includes { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tt-include-tag { font-size: 10px; font-weight: 600; padding: 3px 8px; border-radius: 4px; display: flex; align-items: center; gap: 4px; }
.tt-include-subtasks { background: #e8f5e9; color: #2e7d32; }
.tt-include-linked { background: #e3f2fd; color: #1565c0; }

.tt-card-footer { display: flex; gap: 8px; align-items: center; border-top: 1px solid #f0f0f0; padding-top: 12px; }
.tt-card-btn-use {
    flex: 1; padding: 7px 0; background: #2962FF; color: #fff; border: none;
    border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
    transition: background 0.15s; font-family: inherit;
}
.tt-card-btn-use:hover { background: #1e4fcc; }
.tt-card-btn-more {
    width: 32px; height: 32px; background: #f5f5f5; border: none; border-radius: 6px;
    font-size: 16px; cursor: pointer; color: #888; transition: all 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.tt-card-btn-more:hover { background: #e8e8e8; color: #333; }

/* ── Dropdown ── */
.tt-dropdown {
    position: absolute; top: 52px; left: 16px; background: #fff;
    border: 1px solid #e0e0e0; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    min-width: 160px; z-index: 20; display: none;
}
.tt-dropdown.open { display: block; }
.tt-dropdown-item {
    padding: 9px 16px; font-size: 13px; color: #333; cursor: pointer;
    transition: background 0.1s; display: flex; align-items: center; gap: 8px;
}
.tt-dropdown-item:hover { background: #f5f8ff; }
.tt-dropdown-item:first-child { border-radius: 8px 8px 0 0; }
.tt-dropdown-item:last-child { border-radius: 0 0 8px 8px; }
.tt-dropdown-item.danger { color: #e53935; }
.tt-dropdown-item.danger:hover { background: #fce4ec; }
.tt-dropdown-sep { height: 1px; background: #f0f0f0; margin: 4px 0; }

/* ── List View ── */
.tt-list { display: none; }
.tt-list.active { display: block; }
.tt-list-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.tt-list-table th {
    text-align: left; font-size: 11px; font-weight: 600; color: #888;
    text-transform: uppercase; letter-spacing: 0.5px; padding: 10px 14px;
    border-bottom: 2px solid #e8e8e8; background: #fafbfc;
}
.tt-list-table th:first-child { border-radius: 8px 0 0 0; }
.tt-list-table th:last-child { border-radius: 0 8px 0 0; }
.tt-list-table td { padding: 12px 14px; border-bottom: 1px solid #f0f0f0; font-size: 13px; color: #333; vertical-align: middle; }
.tt-list-table tr { background: #fff; transition: background 0.1s; cursor: pointer; }
.tt-list-table tbody tr:hover { background: #f5f8ff; }
.tt-list-name { font-weight: 600; color: #1a1a1a; }
.tt-list-desc { font-size: 12px; color: #999; margin-top: 2px; max-width: 300px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-list-actions { display: flex; gap: 4px; }
.tt-list-action-btn {
    width: 30px; height: 30px; border: none; background: #f5f5f5; border-radius: 6px;
    cursor: pointer; font-size: 13px; color: #888; transition: all 0.12s;
    display: flex; align-items: center; justify-content: center;
}
.tt-list-action-btn:hover { background: #e8f0fe; color: #2962FF; }
.tt-list-action-btn.fav-btn.active { color: #ffb300; background: #fff8e1; }

/* ── Empty state ── */
.tt-empty {
    text-align: center; padding: 60px 20px; color: #aaa;
}
.tt-empty-icon { font-size: 48px; margin-bottom: 12px; }
.tt-empty-text { font-size: 14px; font-weight: 500; margin-bottom: 4px; color: #888; }
.tt-empty-hint { font-size: 12px; color: #bbb; }

/* ═══════════════════════════════════════════════════════════
   Modals
   ═══════════════════════════════════════════════════════════ */
.tt-modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.4);
    display: none; justify-content: center; align-items: center; z-index: 1070;
}
.tt-modal-overlay.open { display: flex; }
.tt-modal {
    background: #fff; border-radius: 12px; width: 580px; max-height: 85vh;
    box-shadow: 0 12px 48px rgba(0,0,0,0.2); display: flex; flex-direction: column;
    overflow: hidden; animation: ttModalIn 0.2s ease;
}
@keyframes ttModalIn { from { opacity: 0; transform: translateY(-10px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.tt-modal.use-modal { width: 520px; }
.tt-modal-header {
    padding: 20px 24px; border-bottom: 1px solid #eee;
    display: flex; justify-content: space-between; align-items: center;
}
.tt-modal-header h2 { font-size: 17px; font-weight: 600; color: #1a1a1a; }
.tt-modal-close {
    background: none; border: none; font-size: 20px; color: #aaa; cursor: pointer;
    width: 32px; height: 32px; border-radius: 6px; display: flex;
    align-items: center; justify-content: center; transition: all 0.15s;
}
.tt-modal-close:hover { background: #f0f0f0; color: #333; }
.tt-modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.tt-modal-footer {
    padding: 16px 24px; border-top: 1px solid #eee;
    display: flex; gap: 8px; justify-content: flex-end; align-items: center;
}
.tt-modal-footer-hint { font-size: 11px; color: #aaa; margin-right: auto; }

/* ── Form ── */
.tt-form-group { margin-bottom: 18px; }
.tt-form-label {
    display: block; font-size: 12px; font-weight: 600; color: #555; margin-bottom: 6px;
    text-transform: uppercase; letter-spacing: 0.3px;
}
.tt-form-hint { font-size: 11px; color: #bbb; font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 4px; }
.tt-form-input, .tt-form-select, .tt-form-textarea {
    width: 100%; padding: 10px 14px; border: 1.5px solid #d0d5dd !important; border-radius: 8px;
    font-size: 13px; outline: none; transition: border-color 0.15s; font-family: inherit; background: #fff;
}
.tt-form-input:focus, .tt-form-select:focus, .tt-form-textarea:focus { border-color: #2962FF !important; box-shadow: 0 0 0 3px rgba(41,98,255,0.08); }
.tt-form-textarea { resize: vertical; min-height: 70px; }
.tt-form-row { display: flex; gap: 16px; }
.tt-form-row > .tt-form-group { flex: 1; }

/* ── Task search results in create modal ── */
.tt-task-search-results { border: 1px solid #e0e4e8; border-radius: 8px; max-height: 220px; overflow-y: auto; }
.tt-task-search-item {
    display: flex; align-items: center; gap: 10px; padding: 11px 14px;
    cursor: pointer; transition: background 0.1s; border-bottom: 1px solid #f5f5f5;
}
.tt-task-search-item:last-child { border-bottom: none; }
.tt-task-search-item:hover { background: #f5f8ff; }
.tt-task-search-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.tt-task-search-name { font-size: 13px; font-weight: 500; color: #333; flex: 1; }
.tt-task-search-id { font-size: 11px; color: #bbb; }
.tt-task-search-badge { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 3px; }
.tt-badge-completed { background: #e8f5e9; color: #2e7d32; }
.tt-badge-in-progress { background: #fff3e0; color: #e65100; }
.tt-badge-open { background: #e3f2fd; color: #1565c0; }

/* ── Selected task card ── */
.tt-selected-task-card {
    background: #f0f7ff; border: 1.5px solid #b3d4f7; border-radius: 10px;
    padding: 16px 18px; margin-bottom: 18px;
}
.tt-stc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.tt-stc-title { font-size: 15px; font-weight: 600; color: #1a237e; }
.tt-stc-meta { font-size: 11px; color: #90a4ae; margin-top: 2px; }
.tt-stc-change-btn {
    font-size: 12px; color: #2962FF; background: none; border: none;
    cursor: pointer; text-decoration: underline; font-family: inherit;
}
.tt-stc-change-btn:hover { color: #1e4fcc; }
.tt-stc-desc { font-size: 12px; color: #555; line-height: 1.5; }

/* ── Included items preview ── */
.tt-included-section { margin-top: 14px; padding-top: 14px; border-top: 1px solid #dce8f4; }
.tt-included-title {
    font-size: 11px; font-weight: 700; color: #666; text-transform: uppercase;
    letter-spacing: 0.4px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.tt-included-count {
    background: #e3edf7; color: #2962FF; font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 10px;
}
.tt-included-list { list-style: none; padding: 0; margin: 0; }
.tt-included-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px;
    border-radius: 5px; margin-bottom: 3px; font-size: 12px; color: #444;
}
.tt-included-item:hover { background: #f0f4ff; }
.tt-included-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.tt-included-type {
    font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 3px;
    text-transform: uppercase;
}
.tt-type-subtask { background: #e8f5e9; color: #2e7d32; }
.tt-type-dep { background: #fff3e0; color: #e65100; }
.tt-type-linked { background: #e3f2fd; color: #1565c0; }
.tt-included-nested { margin-right: 22px; border-right: 2px solid #e8ecf0; padding-right: 10px; }

/* ── Template info bar (use modal) ── */
.tt-info-bar {
    background: #f0f7ff; border: 1px solid #d0e3f7; border-radius: 8px;
    padding: 12px 16px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px;
}
.tt-info-bar-icon { font-size: 18px; }
.tt-info-name { font-size: 13px; font-weight: 600; color: #1565c0; }
.tt-info-meta { font-size: 11px; color: #90a4ae; }

/* ── Client bar ── */
.tt-client-bar {
    background: #f0f7ff; border: 1.5px solid #b3d4f7; border-radius: 8px;
    padding: 12px 16px; margin-bottom: 18px; display: flex; align-items: center; gap: 12px;
}
.tt-client-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: #e8e0ff;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: #6C5CE7; flex-shrink: 0;
}
.tt-client-details { flex: 1; }
.tt-client-name { font-size: 14px; font-weight: 600; color: #1a237e; }
.tt-client-phone { font-size: 12px; color: #90a4ae; margin-top: 1px; }
.tt-client-label {
    font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px;
    color: #90a4ae; margin-bottom: 2px;
}

/* ── No client warning ── */
.tt-no-client-bar {
    background: #fff8e1; border: 1.5px solid #ffe082; border-radius: 8px;
    padding: 14px 16px; margin-bottom: 18px; display: flex; align-items: center; gap: 12px;
}
.tt-no-client-icon { font-size: 22px; flex-shrink: 0; }
.tt-no-client-text { font-size: 13px; color: #e65100; font-weight: 500; line-height: 1.4; }
.tt-no-client-text a { color: #2962FF; text-decoration: underline; cursor: pointer; font-weight: 600; }

/* ── Creation summary ── */
.tt-creation-summary {
    background: #f8f9fb; border: 1px solid #e8ecf0; border-radius: 8px;
    padding: 14px; font-size: 12px; color: #666; line-height: 1.6;
}
.tt-creation-summary strong { color: #333; }
.tt-creation-summary .tt-summary-client { color: #1a237e; font-weight: 600; }

/* ── Scrollbar ── */
.tt-modal-body::-webkit-scrollbar, .tt-task-search-results::-webkit-scrollbar { width: 5px; }
.tt-modal-body::-webkit-scrollbar-thumb, .tt-task-search-results::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }

/* ── Aliases for new class names used by blade/JS ── */
.tt-grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.tt-list-view { display: block; }
.tt-template-card { background: #fff; border: 1px solid #e4e7eb; border-radius: 12px; padding: 20px; cursor: default; transition: all 0.15s; display: flex; flex-direction: column; position: relative; }
.tt-template-card:hover { border-color: #90caf9; box-shadow: 0 4px 16px rgba(41,98,255,0.08); transform: translateY(-1px); }
.tt-template-info-bar { background: #f0f7ff; border: 1px solid #d0e3f7; border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; display: flex; align-items: center; gap: 10px; }
.tt-template-info-name { font-size: 13px; font-weight: 600; color: #1565c0; }
.tt-template-info-meta { font-size: 11px; color: #90a4ae; }
.tt-modal-use { width: 520px; }
.tt-type-dep-blocks { background: #ffe0b2; color: #e65100; }

/* ── Dynamic category chips ── */
.tt-chip[data-category-id] { color: var(--chip-color, #7b1fa2); background: var(--chip-bg, #f3e5f5); border-color: var(--chip-color, #7b1fa2); }
.tt-chip[data-category-id].active { color: var(--chip-color, #7b1fa2); background: var(--chip-bg, #f3e5f5); border-color: var(--chip-color, #7b1fa2); font-weight: 600; box-shadow: 0 0 0 2px var(--chip-color, #7b1fa2); }
.tt-chip.tt-chip-manage { background: #f5f5f5; color: #888; border-color: #dde1e6; font-size: 16px; padding: 5px 10px; }
.tt-chip.tt-chip-manage:hover { background: #e8f0fe; color: #2962FF; border-color: #90caf9; }

/* ── Category selector combobox ── */
.tt-category-selector { position: relative; }
.tt-category-create-inline { display: flex; gap: 6px; align-items: center; }
.tt-category-create-inline .tt-form-input { flex: 1; }
.tt-category-cancel-btn { width: 28px; height: 28px; border-radius: 50%; border: none; background: #f0f0f0; color: #888; font-size: 18px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.tt-category-cancel-btn:hover { background: #e0e0e0; color: #333; }
.tt-category-hint { font-size: 11px; color: #90a4ae; margin-top: 4px; }

/* ── Manage categories modal list ── */
.tt-cat-manage-list { list-style: none; padding: 0; margin: 0; }
.tt-cat-manage-item { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid #f0f0f0; }
.tt-cat-manage-item:last-child { border-bottom: none; }
.tt-cat-manage-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tt-cat-manage-name { flex: 1; font-size: 13px; color: #333; font-weight: 500; }
.tt-cat-manage-actions { display: flex; gap: 4px; }
.tt-cat-rename-btn, .tt-cat-delete-btn { background: none; border: none; cursor: pointer; padding: 4px 6px; border-radius: 4px; font-size: 14px; color: #aaa; }
.tt-cat-rename-btn:hover { background: #e8f0fe; color: #2962FF; }
.tt-cat-delete-btn:hover { background: #fdecea; color: #e53935; }
.tt-cat-rename-input { border: 1px solid #90caf9; border-radius: 6px; padding: 4px 8px; font-size: 13px; flex: 1; }
.tt-cat-manage-add { display: flex; gap: 8px; align-items: center; padding: 14px 20px; border-top: 1px solid #f0f0f0; }
.tt-cat-manage-add .tt-form-input { flex: 1; }
.tt-cat-add-btn { background: #2962FF; color: #fff; border: none; border-radius: 6px; padding: 6px 14px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.tt-cat-add-btn:hover { background: #1a47cc; }
.tt-cat-add-btn:disabled { opacity: .6; cursor: default; }
