/* Smart Timesheets - Styles */

/* ========================================================================
   Controls Bar
   ======================================================================== */

.ts-controls {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--ws-card-bg);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    box-shadow: var(--ws-shadow);
    flex-wrap: wrap;
}

.ts-control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.ts-control-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ws-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ts-select {
    padding: 8px 12px;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    background: var(--ws-card-bg);
    color: var(--ws-text);
    font-size: 14px;
    font-family: inherit;
    min-width: 220px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.ts-select:hover {
    border-color: var(--ws-accent);
}

.ts-select:focus {
    outline: none;
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-light);
}

/* Week Navigation */
.ts-week-nav {
    min-width: 260px;
}

.ts-week-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ts-week-btn {
    width: 32px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    background: var(--ws-card-bg);
    color: var(--ws-text);
    cursor: pointer;
    font-size: 12px;
    transition: all 0.15s;
}

.ts-week-btn:hover {
    background: var(--ws-accent-light);
    border-color: var(--ws-accent);
    color: var(--ws-accent);
}

.ts-week-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ws-text);
    min-width: 180px;
    text-align: center;
    white-space: nowrap;
}

.ts-generate-btn {
    height: 36px;
}

/* ========================================================================
   Loading State
   ======================================================================== */

.ts-loading {
    text-align: center;
    padding: 60px 20px;
}

.ts-loading p {
    margin-top: 12px;
    color: var(--ws-text-secondary);
    font-size: 14px;
}

/* ========================================================================
   Summary Bar
   ======================================================================== */

.ts-summary-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.ts-summary-card {
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    background: var(--ws-card-bg);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    box-shadow: var(--ws-shadow);
}

.ts-summary-card .ts-sc-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--ws-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.ts-summary-card .ts-sc-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--ws-text);
}

.ts-summary-card .ts-sc-value.ts-sc-accent {
    color: var(--ws-accent);
}

/* ========================================================================
   Timesheet Table
   ======================================================================== */

.ts-table-wrap {
    background: var(--ws-card-bg);
    border: 1px solid var(--ws-border);
    border-radius: var(--ws-radius);
    box-shadow: var(--ws-shadow);
    overflow: hidden;
}

.ts-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.ts-table thead th {
    background: var(--ws-bg);
    color: var(--ws-text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 10px 12px;
    text-align: left;
    border-bottom: 2px solid var(--ws-border);
}

.ts-col-day { width: 110px; }
.ts-col-events { width: auto; }
.ts-col-login { width: 130px; }
.ts-col-suggested { width: 90px; text-align: center; }
.ts-col-hours { width: 90px; text-align: center; }
.ts-col-notes { width: 160px; }
.ts-col-detail { width: 44px; text-align: center; }

.ts-table tbody td {
    padding: 12px 12px;
    border-bottom: 1px solid var(--ws-border);
    vertical-align: top;
    font-size: 14px;
}

.ts-table tbody tr:nth-child(even) {
    background: rgba(0, 0, 0, 0.015);
}

[data-theme="dark"] .ts-table tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

.ts-table tbody tr.ts-weekend {
    background: rgba(0, 0, 0, 0.035);
}

[data-theme="dark"] .ts-table tbody tr.ts-weekend {
    background: rgba(255, 255, 255, 0.04);
}

.ts-table tbody tr:hover {
    background: var(--ws-accent-light);
}

/* Day Column */
.ts-day-name {
    font-weight: 600;
    color: var(--ws-text);
    display: block;
}

.ts-day-date {
    font-size: 12px;
    color: var(--ws-text-secondary);
}

.ts-day-bar-wrap {
    margin-top: 6px;
    height: 6px;
    background: var(--ws-border);
    border-radius: 3px;
    overflow: hidden;
}

.ts-day-bar {
    height: 100%;
    background: var(--ws-accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Calendar Events Column */
.ts-events-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ts-event-item {
    font-size: 12px;
    padding: 3px 0;
    color: var(--ws-text);
    display: flex;
    gap: 6px;
    align-items: baseline;
}

.ts-event-time {
    color: var(--ws-text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 11px;
}

.ts-event-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ts-event-duration {
    color: var(--ws-text-secondary);
    font-size: 11px;
    white-space: nowrap;
}

.ts-events-toggle {
    font-size: 11px;
    color: var(--ws-accent);
    cursor: pointer;
    background: none;
    border: none;
    padding: 2px 0;
    font-family: inherit;
}

.ts-events-toggle:hover {
    text-decoration: underline;
}

.ts-no-events {
    color: var(--ws-text-secondary);
    font-size: 12px;
    font-style: italic;
}

/* Login Window Column */
.ts-login-window {
    font-size: 13px;
    color: var(--ws-text);
}

.ts-login-arrow {
    color: var(--ws-text-secondary);
    margin: 0 4px;
}

.ts-no-login {
    color: var(--ws-text-secondary);
    font-size: 12px;
    font-style: italic;
}

/* Suggested Hours */
.ts-suggested {
    font-size: 18px;
    font-weight: 700;
    color: var(--ws-text);
    text-align: center;
    display: block;
}

.ts-suggested.ts-zero {
    color: var(--ws-text-secondary);
    font-weight: 400;
}

/* Editable Hours */
.ts-hours-input {
    width: 70px;
    padding: 6px 8px;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    background: var(--ws-card-bg);
    color: var(--ws-text);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.ts-hours-input:focus {
    outline: none;
    border-color: var(--ws-accent);
    box-shadow: 0 0 0 3px var(--ws-accent-light);
}

.ts-hours-input:hover {
    border-color: var(--ws-accent);
}

/* Notes */
.ts-notes-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: var(--ws-text);
    font-size: 12px;
    font-family: inherit;
    transition: border-color 0.15s, background 0.15s;
    resize: none;
    min-height: 32px;
}

.ts-notes-input:hover {
    border-color: var(--ws-border);
    background: var(--ws-card-bg);
}

.ts-notes-input:focus {
    outline: none;
    border-color: var(--ws-accent);
    background: var(--ws-card-bg);
    box-shadow: 0 0 0 3px var(--ws-accent-light);
}

/* Detail Button */
.ts-detail-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ws-border);
    border-radius: 6px;
    background: var(--ws-card-bg);
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s;
    padding: 0;
    line-height: 1;
}

.ts-detail-btn:hover {
    background: var(--ws-accent-light);
    border-color: var(--ws-accent);
}

/* Total Row */
.ts-total-row td {
    border-top: 2px solid var(--ws-border);
    border-bottom: none;
    padding: 14px 12px;
    background: var(--ws-bg);
}

.ts-total-label {
    text-align: right;
    font-weight: 700;
    font-size: 14px;
    color: var(--ws-text);
}

.ts-total-suggested {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    color: var(--ws-text-secondary);
}

.ts-total-hours {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    color: var(--ws-accent);
}

/* ========================================================================
   Actions
   ======================================================================== */

.ts-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--ws-border);
}

.ts-approve-btn {
    font-size: 14px;
    font-weight: 600;
    padding: 10px 24px;
}

/* ========================================================================
   Empty State
   ======================================================================== */

.ts-empty {
    text-align: center;
    padding: 80px 20px 60px;
}

.ts-empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.ts-empty p {
    font-size: 15px;
    color: var(--ws-text-secondary);
    margin-bottom: 8px;
}

.ts-empty-sub {
    font-size: 13px;
    color: var(--ws-text-secondary);
    opacity: 0.7;
}

/* ========================================================================
   Confirmation Overlay
   ======================================================================== */

.ts-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: ts-fade-in 0.15s ease;
}

@keyframes ts-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.ts-confirm-modal {
    background: var(--ws-card-bg);
    border-radius: var(--ws-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 24px 28px;
    max-width: 420px;
    width: 90%;
}

.ts-confirm-modal h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--ws-text);
    margin-bottom: 12px;
}

.ts-confirm-modal p {
    font-size: 14px;
    color: var(--ws-text-secondary);
    margin-bottom: 20px;
    line-height: 1.6;
}

.ts-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========================================================================
   Activity Detail Modal
   ======================================================================== */

.ts-activity-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    animation: ts-fade-in 0.15s ease;
}

.ts-activity-modal {
    background: var(--ws-card-bg);
    border-radius: var(--ws-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 640px;
    width: 95%;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.ts-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--ws-border);
}

.ts-activity-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--ws-text);
    margin: 0;
}

.ts-activity-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: none;
    font-size: 22px;
    color: var(--ws-text-secondary);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.ts-activity-close:hover {
    background: var(--ws-accent-light);
    color: var(--ws-text);
}

.ts-activity-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.ts-activity-error {
    color: var(--ws-danger);
    padding: 16px;
    background: rgba(220, 38, 38, 0.08);
    border-radius: 6px;
    font-size: 14px;
}

.ts-activity-section {
    margin-bottom: 24px;
}

.ts-activity-section:last-child {
    margin-bottom: 0;
}

.ts-activity-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ws-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--ws-border);
}

.ts-activity-none {
    color: var(--ws-text-secondary);
    font-size: 13px;
    font-style: italic;
}

/* Activity Events */
.ts-activity-events {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ts-activity-event {
    padding: 10px 12px;
    background: var(--ws-bg);
    border-radius: 6px;
    border: 1px solid var(--ws-border);
}

.ts-activity-event-time {
    font-size: 12px;
    color: var(--ws-accent);
    font-weight: 600;
    margin-bottom: 2px;
}

.ts-activity-event-dur {
    font-weight: 400;
    color: var(--ws-text-secondary);
}

.ts-activity-event-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ws-text);
}

.ts-activity-event-loc {
    font-size: 12px;
    color: var(--ws-text-secondary);
    margin-top: 2px;
}

.ts-activity-event-att {
    font-size: 11px;
    color: var(--ws-text-secondary);
    margin-top: 2px;
}

/* Activity Login Table */
.ts-activity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ts-activity-table th {
    text-align: left;
    font-weight: 600;
    color: var(--ws-text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--ws-border);
}

.ts-activity-table td {
    padding: 6px 10px;
    border-bottom: 1px solid var(--ws-border);
    color: var(--ws-text);
}

.ts-activity-table tr:last-child td {
    border-bottom: none;
}

.ts-activity-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.ts-activity-badge-success {
    background: rgba(22, 163, 74, 0.1);
    color: var(--ws-success);
}

.ts-activity-badge-other {
    background: rgba(100, 116, 139, 0.1);
    color: var(--ws-text-secondary);
}

.ts-activity-login-summary {
    margin-top: 10px;
    padding: 8px 12px;
    background: var(--ws-accent-light);
    border-radius: 6px;
    font-size: 13px;
    color: var(--ws-text);
}

/* Activity Email Stats */
.ts-activity-email-stats {
    display: flex;
    gap: 16px;
}

.ts-activity-email-stat {
    flex: 1;
    padding: 10px 14px;
    background: var(--ws-bg);
    border-radius: 6px;
    border: 1px solid var(--ws-border);
}

.ts-activity-email-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--ws-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.ts-activity-email-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--ws-text);
}

.ts-activity-note {
    margin-top: 8px;
    font-size: 12px;
    color: var(--ws-text-secondary);
    font-style: italic;
}

/* ========================================================================
   Responsive
   ======================================================================== */

@media (max-width: 900px) {
    .ts-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .ts-control-group {
        width: 100%;
    }

    .ts-select {
        min-width: auto;
        width: 100%;
    }

    .ts-week-selector {
        justify-content: center;
    }

    .ts-table {
        table-layout: auto;
    }

    .ts-col-events,
    .ts-col-notes {
        display: none;
    }

    /* Hide Events and Notes columns on mobile */
    .ts-table thead th:nth-child(2),
    .ts-table thead th:nth-child(6),
    .ts-table tbody td:nth-child(2),
    .ts-table tbody td:nth-child(6) {
        display: none;
    }

    .ts-col-day { width: auto; }
    .ts-col-login { width: auto; }

    .ts-activity-modal {
        width: 98%;
        max-height: 90vh;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 12px 12px;
    }

    .ts-table tbody td {
        padding: 8px 8px;
    }

    .ts-hours-input {
        width: 56px;
        font-size: 14px;
    }

    .ts-summary-bar {
        gap: 8px;
    }

    .ts-summary-card {
        min-width: 100px;
        padding: 8px 12px;
    }

    .ts-summary-card .ts-sc-value {
        font-size: 18px;
    }

    .ts-activity-email-stats {
        flex-direction: column;
        gap: 8px;
    }
}
