/* ── Task & Time Manager — Frontend Styles ──────────────── */
:root {
    --ttm-primary:   #4f46e5;
    --ttm-primary-h: #4338ca;
    --ttm-success:   #10b981;
    --ttm-warning:   #f59e0b;
    --ttm-danger:    #ef4444;
    --ttm-bg:        #f8fafc;
    --ttm-surface:   #ffffff;
    --ttm-border:    #e2e8f0;
    --ttm-text:      #1e293b;
    --ttm-muted:     #64748b;
    --ttm-radius:    12px;
    --ttm-shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
    --ttm-shadow-lg: 0 20px 40px rgba(0,0,0,.15);
}

.ttm-frontend-wrap, .ttm-login-box { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: var(--ttm-text); }
.ttm-frontend-wrap *, .ttm-login-box * { box-sizing: border-box; }

/* ── Top Bar ─────────────────────────────────────────────── */
.ttm-top-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; padding: 18px 22px; background: var(--ttm-surface); border: 1px solid var(--ttm-border); border-radius: var(--ttm-radius); margin-bottom: 18px; box-shadow: var(--ttm-shadow); }
.ttm-top-bar-left { display: flex; flex-direction: column; gap: 2px; }
.ttm-top-bar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ttm-page-title { margin: 0; font-size: 1.4rem; font-weight: 800; color: var(--ttm-primary); }
.ttm-user-greeting { font-size: .85rem; color: var(--ttm-muted); }

/* ── Buttons ─────────────────────────────────────────────── */
.ttm-btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 20px; border-radius: 8px; border: none; cursor: pointer; font-size: .875rem; font-weight: 600; text-decoration: none; transition: background .15s, transform .1s, box-shadow .15s; line-height: 1; }
.ttm-btn:hover { text-decoration: none; }
.ttm-btn:active { transform: scale(.97); }
.ttm-btn-primary { background: var(--ttm-primary); color: #fff !important; }
.ttm-btn-primary:hover { background: var(--ttm-primary-h); box-shadow: 0 4px 12px rgba(79,70,229,.35); }
.ttm-btn-secondary { background: #f1f5f9; color: var(--ttm-text) !important; }
.ttm-btn-secondary:hover { background: #e2e8f0; }
.ttm-btn-logout { background: #fee2e2; color: #991b1b !important; font-size: .8rem; padding: 7px 14px; }
.ttm-btn-logout:hover { background: #fecaca; }
.ttm-btn-danger { background: var(--ttm-danger); color: #fff !important; font-size: .78rem; padding: 5px 12px; }
.ttm-btn-timer { background: var(--ttm-success); color: #fff !important; font-size: .78rem; padding: 6px 12px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; transition: background .15s; }
.ttm-btn-timer.active { background: var(--ttm-warning); }
.ttm-btn-sm { font-size: .78rem; padding: 5px 10px; border-radius: 6px; border: none; cursor: pointer; font-weight: 600; }
.ttm-btn-block { width: 100%; justify-content: center; padding: 12px; font-size: 1rem; margin-top: 8px; }

/* ── Filters ─────────────────────────────────────────────── */
.ttm-filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.ttm-filters input, .ttm-filters select { padding: 9px 14px; border: 1px solid var(--ttm-border); border-radius: 8px; font-size: .875rem; background: #fff; color: var(--ttm-text); flex: 1 1 160px; }
.ttm-filters input:focus, .ttm-filters select:focus { outline: none; border-color: var(--ttm-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* ── Summary Pills ───────────────────────────────────────── */
.ttm-summary { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.ttm-summary-pill { background: var(--ttm-surface); border: 1px solid var(--ttm-border); border-radius: 20px; padding: 6px 16px; font-size: .8rem; color: var(--ttm-muted); box-shadow: var(--ttm-shadow); }
.ttm-summary-pill strong { color: var(--ttm-text); }

/* ── Task Cards ──────────────────────────────────────────── */
.ttm-task-list { display: grid; gap: 14px; }
.ttm-task-card { background: var(--ttm-surface); border: 1px solid var(--ttm-border); border-radius: var(--ttm-radius); padding: 18px 20px; box-shadow: var(--ttm-shadow); display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start; transition: box-shadow .2s, transform .15s; }
.ttm-task-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); transform: translateY(-1px); }
.ttm-task-card.priority-high   { border-left: 4px solid var(--ttm-danger); }
.ttm-task-card.priority-medium { border-left: 4px solid var(--ttm-warning); }
.ttm-task-card.priority-low    { border-left: 4px solid var(--ttm-success); }
.ttm-task-card.status-completed { opacity: .72; }

.ttm-card-title { font-weight: 700; font-size: 1rem; margin: 0 0 5px; }
.ttm-card-desc  { color: var(--ttm-muted); font-size: .83rem; margin: 0 0 10px; line-height: 1.5; }
.ttm-card-meta  { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.ttm-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .72rem; font-weight: 700; }
.ttm-badge-status-pending     { background: #e0f2fe; color: #0369a1; }
.ttm-badge-status-in_progress { background: #fef3c7; color: #92400e; }
.ttm-badge-status-completed   { background: #dcfce7; color: #166534; }
.ttm-badge-status-cancelled   { background: #fee2e2; color: #991b1b; }
.ttm-badge-priority-high   { background: #fee2e2; color: #b91c1c; }
.ttm-badge-priority-medium { background: #fef3c7; color: #b45309; }
.ttm-badge-priority-low    { background: #dcfce7; color: #15803d; }

.ttm-card-time-info { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 10px; font-size: .82rem; color: var(--ttm-muted); }
.ttm-card-time-info strong { color: var(--ttm-primary); }
.ttm-timer-display { font-weight: 700; color: var(--ttm-warning); font-variant-numeric: tabular-nums; }
.ttm-overdue { color: var(--ttm-danger); font-weight: 700; }

.ttm-card-actions { display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }
.ttm-card-actions-row { display: flex; gap: 6px; align-items: center; }
.ttm-quick-status { font-size: .78rem; padding: 5px 8px; border-radius: 6px; border: 1px solid var(--ttm-border); background: #fff; cursor: pointer; }

/* ── Modal ───────────────────────────────────────────────── */
.ttm-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 99999; display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(3px); }
.ttm-modal { background: #fff; border-radius: 16px; padding: 30px; width: min(580px, 100%); max-height: 90vh; overflow-y: auto; box-shadow: var(--ttm-shadow-lg); animation: ttm-modal-in .2s ease; }
@keyframes ttm-modal-in { from { opacity:0; transform: scale(.95) translateY(10px); } to { opacity:1; transform: scale(1) translateY(0); } }
.ttm-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.ttm-modal-header h3 { margin: 0; font-size: 1.15rem; font-weight: 700; }
.ttm-modal-close { background: #f1f5f9; border: none; border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 1rem; color: var(--ttm-muted); display: flex; align-items: center; justify-content: center; }
.ttm-modal-close:hover { background: #e2e8f0; }
.ttm-modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--ttm-border); }

.ttm-form-row { margin-bottom: 16px; }
.ttm-form-row label { display: block; font-weight: 600; font-size: .84rem; margin-bottom: 6px; color: var(--ttm-muted); }
.ttm-form-row input, .ttm-form-row select, .ttm-form-row textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--ttm-border); border-radius: 8px; font-size: .9rem; color: var(--ttm-text); background: #fff; }
.ttm-form-row input:focus, .ttm-form-row select:focus, .ttm-form-row textarea:focus { outline: none; border-color: var(--ttm-primary); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.ttm-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

/* ── Logs Table ──────────────────────────────────────────── */
.ttm-logs-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.ttm-logs-table th { background: #f8fafc; padding: 9px 14px; text-align: left; color: var(--ttm-muted); border-bottom: 2px solid var(--ttm-border); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.ttm-logs-table td { padding: 9px 14px; border-bottom: 1px solid var(--ttm-border); }
.ttm-logs-total { padding: 12px 0 0; font-weight: 700; color: var(--ttm-primary); font-size: .9rem; }

/* ── Stats ───────────────────────────────────────────────── */
.ttm-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.ttm-stat-card { background: var(--ttm-surface); border: 1px solid var(--ttm-border); border-radius: var(--ttm-radius); padding: 22px 18px; box-shadow: var(--ttm-shadow); text-align: center; }
.ttm-stat-number { font-size: 2.2rem; font-weight: 800; color: var(--ttm-primary); line-height: 1; }
.ttm-stat-label { font-size: .82rem; color: var(--ttm-muted); margin-top: 6px; }
.ttm-charts-grid { display: grid; grid-template-columns: minmax(250px,1fr) minmax(300px,2fr); gap: 20px; }
.ttm-chart-card { background: var(--ttm-surface); border: 1px solid var(--ttm-border); border-radius: var(--ttm-radius); padding: 22px; box-shadow: var(--ttm-shadow); }
.ttm-chart-card h3 { margin: 0 0 18px; font-size: .95rem; font-weight: 700; color: var(--ttm-muted); text-transform: uppercase; letter-spacing: .05em; }

/* ── Login Box ───────────────────────────────────────────── */
.ttm-login-box { max-width: 440px; margin: 0 auto; background: var(--ttm-surface); border: 1px solid var(--ttm-border); border-radius: 20px; padding: 40px 36px; box-shadow: var(--ttm-shadow-lg); }
.ttm-login-icon { font-size: 3rem; text-align: center; margin-bottom: 10px; }
.ttm-login-title { text-align: center; margin: 0 0 6px; font-size: 1.4rem; font-weight: 800; }
.ttm-login-subtitle { text-align: center; color: var(--ttm-muted); font-size: .88rem; margin: 0 0 24px; }
.ttm-login-form .ttm-form-row input { padding: 11px 14px; }
.ttm-remember-row { display: flex; justify-content: space-between; align-items: center; }
.ttm-checkbox-label { display: flex; align-items: center; gap: 6px; font-size: .85rem; cursor: pointer; }
.ttm-checkbox-label input { width: auto; margin: 0; }
.ttm-forgot-link { font-size: .82rem; color: var(--ttm-primary); text-decoration: none; }
.ttm-forgot-link:hover { text-decoration: underline; }
.ttm-register-link { text-align: center; font-size: .85rem; color: var(--ttm-muted); margin-top: 18px; }
.ttm-register-link a { color: var(--ttm-primary); text-decoration: none; font-weight: 600; }
.ttm-password-wrap { position: relative; }
.ttm-password-wrap input { padding-right: 46px; }
.ttm-toggle-pw { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1.1rem; padding: 0; line-height: 1; }

/* Logged-in state */
.ttm-logged-in { text-align: center; }
.ttm-logged-avatar { font-size: 3.5rem; margin-bottom: 8px; }
.ttm-logged-name { font-size: 1.1rem; font-weight: 700; margin: 0 0 4px; }
.ttm-logged-email { color: var(--ttm-muted); font-size: .85rem; margin: 0 0 20px; }

/* ── Alerts ──────────────────────────────────────────────── */
.ttm-alert { padding: 12px 16px; border-radius: 9px; font-size: .88rem; margin-bottom: 16px; font-weight: 500; }
.ttm-alert-error { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; }

/* ── Loading / Empty ─────────────────────────────────────── */
.ttm-loading, .ttm-empty { text-align: center; padding: 50px 20px; color: var(--ttm-muted); font-size: .95rem; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
    .ttm-form-grid { grid-template-columns: 1fr; }
    .ttm-charts-grid { grid-template-columns: 1fr; }
    .ttm-task-card { grid-template-columns: 1fr; }
    .ttm-card-actions { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
    .ttm-login-box { padding: 28px 20px; }
    .ttm-top-bar { flex-direction: column; align-items: flex-start; }
}

/* ── Profiles frontend ───────────────────────────────────── */
.ttm-profiles-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 24px; }
.ttm-profile-card { background: var(--ttm-surface); border: 1px solid var(--ttm-border); border-radius: var(--ttm-radius); padding: 20px 16px; text-align: center; box-shadow: var(--ttm-shadow); transition: box-shadow .2s, transform .15s; }
.ttm-profile-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.1); transform: translateY(-2px); }
.ttm-profile-avatar { width: 60px; height: 60px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.7rem; margin: 0 auto 10px; box-shadow: 0 4px 12px rgba(0,0,0,.15); }
.ttm-profile-name  { font-weight: 800; font-size: .95rem; margin: 0 0 2px; }
.ttm-profile-role  { color: var(--ttm-muted); font-size: .78rem; margin: 0 0 4px; }
.ttm-profile-email { color: var(--ttm-primary); font-size: .75rem; margin: 0 0 12px; }
.ttm-profile-wp-badge { background: #e0f2fe; color: #0369a1; font-size: .68rem; padding: 2px 7px; border-radius: 10px; font-weight: 600; }

.ttm-assignee-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px 3px 4px; border-radius: 20px; font-size: .75rem; font-weight: 600; color: #fff; }
.ttm-assignee-pill .ttm-assignee-icon { width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,.25); display: flex; align-items: center; justify-content: center; font-size: .7rem; }

.ttm-assignee-preview { display: flex; align-items: center; gap: 10px; background: #f8fafc; border: 1px solid var(--ttm-border); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.ttm-mini-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.ttm-assignee-preview-info strong { display: block; font-size: .88rem; }
.ttm-assignee-preview-info span { font-size: .76rem; color: var(--ttm-muted); }

.ttm-assignee-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.ttm-assignee-table th { background: #f8fafc; padding: 9px 14px; text-align: left; color: var(--ttm-muted); border-bottom: 2px solid var(--ttm-border); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; }
.ttm-assignee-table td { padding: 10px 14px; border-bottom: 1px solid var(--ttm-border); }
.ttm-time-bar-wrap { background: #f1f5f9; border-radius: 4px; height: 7px; margin-top: 4px; }
.ttm-time-bar { background: var(--ttm-primary); border-radius: 4px; height: 7px; }
