/* WorkTime Tracker — Frontend Portal */
*, *::before, *::after { box-sizing: border-box; }

.wtt-portal {
    direction: rtl;
    font-family: 'Segoe UI', Arial, sans-serif;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 16px 60px;
    color: #1a1a2e;
}

/* ---- Login ---- */
.wtt-login-wrap {
    display: flex;
    justify-content: center;
    padding-top: 60px;
}
.wtt-login-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
    padding: 40px 48px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}
.wtt-login-logo { font-size: 48px; margin-bottom: 8px; }
.wtt-login-card h2 { margin: 0 0 24px; font-size: 20px; color: #1a1a2e; }
.wtt-login-form { text-align: right; }
.wtt-input-group { margin-bottom: 16px; }
.wtt-input-group label { display: block; font-size: 13px; font-weight: 600; color: #555; margin-bottom: 5px; }
.wtt-input-group input {
    width: 100%;
    border: 1.5px solid #dde1e7;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    transition: border-color .2s;
}
.wtt-input-group input:focus { outline: none; border-color: #5b6af0; }

/* ---- Portal Header ---- */
.wtt-portal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0 16px;
    border-bottom: 2px solid #f0f0f5;
    margin-bottom: 20px;
}
.wtt-portal-title { font-size: 22px; font-weight: 700; color: #1a1a2e; }
.wtt-portal-user { font-size: 14px; color: #555; display: flex; gap: 12px; align-items: center; }
.wtt-logout { color: #e53e3e; text-decoration: none; font-size: 13px; }
.wtt-logout:hover { text-decoration: underline; }

/* ---- Tabs ---- */
.wtt-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid #eef0f5;
    margin-bottom: 20px;
}
.wtt-tab {
    background: none;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: #888;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    border-radius: 6px 6px 0 0;
    transition: all .2s;
}
.wtt-tab:hover { color: #5b6af0; background: #f7f8ff; }
.wtt-tab.active { color: #5b6af0; border-bottom-color: #5b6af0; background: #f7f8ff; }

.wtt-tab-content { display: none; }
.wtt-tab-content.active { display: block; }

/* ---- Form Card ---- */
.wtt-form-card {
    background: #fff;
    border: 1.5px solid #eef0f5;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,.05);
}
.wtt-form-card h3 { margin: 0 0 6px; font-size: 17px; }
.wtt-hint { color: #777; font-size: 13px; margin: 0 0 20px; }

/* ---- Grid rows ---- */
.wtt-row {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.wtt-col { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 5px; }
.wtt-col-full { flex: 0 0 100%; }
.wtt-col label { font-size: 12px; font-weight: 600; color: #666; }
.wtt-col input,
.wtt-col select,
.wtt-col textarea {
    border: 1.5px solid #dde1e7;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .2s;
    width: 100%;
}
.wtt-col input:focus,
.wtt-col select:focus,
.wtt-col textarea:focus { outline: none; border-color: #5b6af0; }
.wtt-col textarea { resize: vertical; }

/* ---- Parts ---- */
.wtt-parts-section {
    background: #f9faff;
    border: 1.5px solid #eef0f5;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 20px;
}
.wtt-parts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 14px;
}
.wtt-parts-head-row {
    display: grid;
    grid-template-columns: 3fr 1fr 1.5fr 32px;
    gap: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #888;
    padding: 0 4px 4px;
    text-align: right;
}
.wtt-part-row {
    display: grid;
    grid-template-columns: 3fr 1fr 1.5fr 32px;
    gap: 8px;
    align-items: center;
    margin-bottom: 7px;
}
.wtt-part-row input {
    border: 1.5px solid #dde1e7;
    border-radius: 7px;
    padding: 7px 10px;
    font-size: 13px;
    width: 100%;
}
.wtt-part-row input:focus { outline: none; border-color: #5b6af0; }
.wtt-remove-part {
    background: none;
    border: none;
    color: #e53e3e;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

/* ---- Buttons ---- */
.wtt-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .15s;
    font-family: inherit;
}
.wtt-btn-primary { background: #5b6af0; color: #fff; }
.wtt-btn-primary:hover { background: #4a58d4; }
.wtt-btn-ghost { background: #fff; color: #5b6af0; border-color: #5b6af0; }
.wtt-btn-ghost:hover { background: #f0f2ff; }
.wtt-btn-full { width: 100%; justify-content: center; }
.wtt-btn-sm { padding: 5px 12px; font-size: 12px; }

/* ---- Alerts ---- */
.wtt-alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.wtt-alert-error { background: #fff0f0; color: #c53030; border: 1px solid #fca5a5; }

.wtt-msg { font-size: 13px; color: #38a169; margin-right: 10px; }
.wtt-msg.error { color: #e53e3e; }

.wtt-form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 6px;
    flex-wrap: wrap;
}

/* ---- Table ---- */
.wtt-table-wrap {
    width: 100%;
    overflow-x: visible;
}
.wtt-fe-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.wtt-fe-table th {
    background: #f4f5ff;
    padding: 11px 10px;
    text-align: right;
    font-size: 12px;
    font-weight: 700;
    color: #555;
    border-bottom: 2px solid #eef0f5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wtt-fe-table td {
    padding: 11px 10px;
    border-bottom: 1px solid #f5f5f8;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.wtt-fe-table tr:hover td { background: #f9faff; }
.wtt-fe-desc {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #777;
}

/* Column widths — fixed layout stretches to fill 100% */
.wtt-fe-table th:nth-child(1), .wtt-fe-table td:nth-child(1) { width: 8%; }   /* תאריך */
.wtt-fe-table th:nth-child(2), .wtt-fe-table td:nth-child(2) { width: 12%; }  /* לקוח */
.wtt-fe-table th:nth-child(3), .wtt-fe-table td:nth-child(3) { width: 12%; }  /* פרויקט */
.wtt-fe-table th:nth-child(4), .wtt-fe-table td:nth-child(4) { width: 7%; }   /* משך */
.wtt-fe-table th:nth-child(5), .wtt-fe-table td:nth-child(5) { width: 9%; }   /* שעות */
.wtt-fe-table th:nth-child(6), .wtt-fe-table td:nth-child(6) { width: 9%; }   /* חלקים */
.wtt-fe-table th:nth-child(7), .wtt-fe-table td:nth-child(7) { width: auto; } /* תיאור — takes remaining space */
.wtt-fe-table th:nth-child(8), .wtt-fe-table td:nth-child(8) { width: 9%; }   /* סטטוס */
.wtt-fe-table th:nth-child(9), .wtt-fe-table td:nth-child(9) { width: 18%; }  /* פעולות */

.wtt-chip {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}
.wtt-chip.billed   { background: #c6f6d5; color: #276749; }
.wtt-chip.unbilled { background: #fefcbf; color: #744210; }

/* ---- Google Calendar Preview ---- */
.wtt-gcal-preview { margin-top: 24px; border-top: 2px solid #eef0f5; padding-top: 20px; }
.wtt-gcal-preview h4 { margin: 0 0 12px; font-size: 15px; }
.wtt-gcal-event {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f9faff;
    border: 1.5px solid #eef0f5;
    border-radius: 9px;
    margin-bottom: 8px;
    font-size: 13px;
}
.wtt-gcal-event input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }
.wtt-gcal-event-title { font-weight: 600; flex: 1; }
.wtt-gcal-event-time { color: #777; white-space: nowrap; }
.wtt-gcal-event-duration { color: #5b6af0; font-weight: 600; white-space: nowrap; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .wtt-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .wtt-fe-table { table-layout: auto; min-width: 700px; }
    .wtt-row { flex-direction: column; }
    .wtt-login-card { padding: 28px 20px; }
    .wtt-tab { padding: 8px 12px; font-size: 13px; }
}

/* Rate pills */
.wtt-rate-wrap { display: flex; flex-direction: column; gap: 6px; }
.wtt-rate-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.wtt-rate-pill {
    padding: 5px 12px;
    border: 2px solid #5b6af0;
    border-radius: 20px;
    background: #fff;
    color: #5b6af0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.wtt-rate-pill:hover, .wtt-rate-pill.active {
    background: #5b6af0;
    color: #fff;
}

/* Manage tab rates list */
.wtt-rates-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px; }
.wtt-rate-item { display: flex; align-items: center; gap: 4px; }
.wtt-rate-item input { width: 80px; border: 1.5px solid #dde1e7; border-radius: 7px; padding: 6px 10px; font-size: 14px; }
.wtt-remove-rate { background: none; border: none; color: #e53e3e; font-size: 16px; cursor: pointer; padding: 0 4px; }

/* Danger button */
.wtt-btn-danger { background: #fff0f0; color: #e53e3e; border-color: #fca5a5; }
.wtt-btn-danger:hover { background: #e53e3e; color: #fff; }

/* Edit mode indicator */
#fe-save-entry.editing {
    background: #d97706;
    border-color: #d97706;
}
#fe-save-entry.editing:hover { background: #b45309; }

.wtt-tbl-actions { white-space: nowrap; overflow: visible; }
.wtt-tbl-actions .wtt-btn { margin-left: 4px; }

/* Login spinner */
.wtt-btn-loading { opacity: .7; pointer-events: none; cursor: not-allowed; }

/* Select + add button inline */
.wtt-select-add { display: flex; gap: 6px; align-items: center; }
.wtt-select-add select { flex: 1; }
.wtt-add-inline {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 2px solid #5b6af0;
    background: #fff;
    color: #5b6af0;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all .15s;
    padding: 0;
}
.wtt-add-inline:hover { background: #5b6af0; color: #fff; }

/* Modals */
.wtt-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 9999;
    display: flex; align-items: center; justify-content: center;
}
.wtt-modal {
    background: #fff;
    border-radius: 14px;
    width: 100%; max-width: 440px;
    box-shadow: 0 16px 48px rgba(0,0,0,.18);
    overflow: hidden;
}
.wtt-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 22px 14px;
    border-bottom: 1.5px solid #eef0f5;
}
.wtt-modal-header h3 { margin: 0; font-size: 16px; }
.wtt-modal-close {
    background: none; border: none; font-size: 18px; cursor: pointer; color: #888; line-height: 1;
}
.wtt-modal-body { padding: 20px 22px; }
.wtt-modal-footer {
    padding: 14px 22px 18px;
    border-top: 1.5px solid #eef0f5;
    display: flex; gap: 10px; align-items: center;
}

/* ---- Billing Bar ---- */
.wtt-billing-bar {
    background: #fffbeb;
    border: 1.5px solid #f6d860;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 18px;
}
.wtt-billing-bar-title {
    font-weight: 700;
    font-size: 14px;
    color: #92400e;
    margin-bottom: 12px;
}
.wtt-billing-client-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 0;
    border-bottom: 1px solid #fde68a;
}
.wtt-billing-client-row:last-child { border-bottom: none; }
.wtt-billing-name {
    font-weight: 700;
    font-size: 14px;
    min-width: 120px;
    color: #1a1a2e;
}
.wtt-billing-info {
    flex: 1;
    font-size: 13px;
    color: #555;
}
.wtt-billing-actions {
    display: flex;
    gap: 8px;
}

/* Success button (green) */
.wtt-btn-success {
    background: #38a169;
    color: #fff;
    border-color: #38a169;
}
.wtt-btn-success:hover { background: #276749; border-color: #276749; }

/* Invoice button */
.wtt-btn-invoice {
    background: #fff;
    color: #5b6af0;
    border-color: #5b6af0;
}
.wtt-btn-invoice:hover { background: #5b6af0; color: #fff; }

/* ---- Totals footer row ---- */
.wtt-totals-row td {
    background: #f4f5ff;
    border-top: 2px solid #5b6af0;
    padding: 12px 10px;
    font-size: 13px;
}
.wtt-grand-total {
    color: #5b6af0;
    font-size: 15px;
}

/* ---- Quick Add Bar + Panel ---- */
.wtt-quick-add-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.wtt-quick-add-panel {
    margin-bottom: 16px;
}

.wtt-qa-card {
    border: 2px solid #5b6af0;
    animation: qaSlideDown 0.2s ease;
}

@keyframes qaSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wtt-qa-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-size: 15px;
    color: #5b6af0;
}

.wtt-qa-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #888;
    line-height: 1;
    padding: 0;
}
.wtt-qa-close:hover { color: #e53e3e; }

.wtt-col-desc { flex: 2; }