/* TBC Hours Logger - Styles */
:root {
    --tbc-bg: #0f1117;
    --tbc-card: #1a1d27;
    --tbc-border: #2a2d3a;
    --tbc-text: #e4e4e7;
    --tbc-muted: #71717a;
    --tbc-accent: #6366f1;
    --tbc-accent-hover: #5558e0;
    --tbc-success: #22c55e;
    --tbc-danger: #ef4444;
    --tbc-warning: #f59e0b;
}

#tbc-app {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--tbc-text);
    background: var(--tbc-bg);
    border-radius: 12px;
    -webkit-text-size-adjust: 100%;
}

.tbc-header h2 {
    margin: 0 0 4px 0;
    font-size: 24px;
}

.tbc-subtitle {
    color: var(--tbc-muted);
    margin: 0 0 24px 0;
    font-size: 14px;
}

.tbc-loading {
    text-align: center;
    padding: 40px;
    color: var(--tbc-muted);
}

.tbc-week-section {
    background: var(--tbc-card);
    border: 1px solid var(--tbc-border);
    border-radius: 8px;
    margin-bottom: 24px;
    overflow: hidden;
}

.tbc-week-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--tbc-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tbc-week-header-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tbc-week-title {
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.tbc-week-range {
    font-size: 13px;
    color: var(--tbc-muted);
}

.tbc-week-badge {
    background: var(--tbc-accent);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* --- Entry list (not a table — card-based) --- */
.tbc-entries {
    padding: 8px 0;
}

.tbc-entry {
    display: grid;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--tbc-border);
    gap: 12px;
}

.tbc-entry:last-child {
    border-bottom: none;
}

/* Desktop: manager grid */
.tbc-entry-manager {
    grid-template-columns: 100px 150px 80px auto;
}

/* Desktop: rider grid */
.tbc-entry-rider {
    grid-template-columns: 90px 130px 70px 70px 60px auto;
}

.tbc-entry-field {
    font-size: 14px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tbc-entry-label {
    display: none;
    font-size: 11px;
    color: var(--tbc-muted);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.tbc-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* --- Column headers (desktop only) --- */
.tbc-col-headers {
    display: grid;
    padding: 10px 20px;
    border-bottom: 1px solid var(--tbc-border);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--tbc-muted);
    gap: 12px;
}

.tbc-col-headers-manager {
    grid-template-columns: 100px 150px 80px auto;
}

.tbc-col-headers-rider {
    grid-template-columns: 90px 130px 70px 70px 60px auto;
}

.tbc-empty {
    text-align: center;
    padding: 24px;
    color: var(--tbc-muted);
    font-size: 14px;
}

/* --- Buttons --- */
.tbc-btn {
    padding: 8px 16px;
    border: 1px solid var(--tbc-border);
    border-radius: 6px;
    background: transparent;
    color: var(--tbc-text);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.tbc-btn:hover {
    border-color: var(--tbc-accent);
    color: var(--tbc-accent);
}

.tbc-btn-primary {
    background: var(--tbc-accent);
    border-color: var(--tbc-accent);
    color: white;
    font-weight: 600;
}

.tbc-btn-primary:hover {
    background: var(--tbc-accent-hover);
    color: white;
}

.tbc-btn-danger {
    color: var(--tbc-danger);
    border-color: transparent;
}

.tbc-btn-danger:hover {
    border-color: var(--tbc-danger);
    background: rgba(239, 68, 68, 0.1);
}

.tbc-btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.tbc-btn-add {
    margin: 12px 20px;
    width: calc(100% - 40px);
    box-sizing: border-box;
    padding: 10px;
    font-size: 15px;
}

/* --- Inputs --- */
.tbc-input, .tbc-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--tbc-bg);
    border: 1px solid var(--tbc-border);
    border-radius: 6px;
    color: var(--tbc-text);
    font-size: 16px; /* 16px prevents iOS zoom on focus */
    box-sizing: border-box;
    -webkit-appearance: none;
}

.tbc-input:focus, .tbc-select:focus {
    outline: none;
    border-color: var(--tbc-accent);
}

.tbc-select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a'%3E%3Cpath d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* --- Edit/Add card (mobile-friendly form) --- */
.tbc-edit-card {
    padding: 16px 20px;
    border-bottom: 1px solid var(--tbc-border);
    background: rgba(99, 102, 241, 0.08);
}

.tbc-edit-card:last-child {
    border-bottom: none;
}

.tbc-form-row {
    margin-bottom: 12px;
}

.tbc-form-row:last-child {
    margin-bottom: 0;
}

.tbc-form-label {
    display: block;
    font-size: 12px;
    color: var(--tbc-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
    font-weight: 600;
}

.tbc-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.tbc-form-actions .tbc-btn {
    flex: 1;
    text-align: center;
}

/* --- Toast --- */
.tbc-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    z-index: 9999;
    animation: tbc-slide-in 0.2s ease;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tbc-toast-success { background: var(--tbc-success); }
.tbc-toast-error { background: var(--tbc-danger); }

@keyframes tbc-slide-in {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* --- Mobile: cards instead of grid rows --- */
@media (max-width: 640px) {
    #tbc-app {
        padding: 12px;
    }

    .tbc-header h2 {
        font-size: 20px;
    }

    .tbc-week-header {
        padding: 12px 16px;
    }

    /* Hide desktop column headers */
    .tbc-col-headers {
        display: none;
    }

    /* Stack entry as card */
    .tbc-entry,
    .tbc-entry-manager,
    .tbc-entry-rider {
        display: block;
        padding: 14px 16px;
    }

    /* Show labels on mobile */
    .tbc-entry-label {
        display: block;
    }

    .tbc-entry-field {
        padding: 4px 0;
        white-space: normal;
    }

    /* Actions full width */
    .tbc-actions {
        margin-top: 8px;
    }

    .tbc-actions .tbc-btn {
        flex: 1;
        text-align: center;
        padding: 8px;
    }

    .tbc-btn-add {
        margin: 10px 16px;
        width: calc(100% - 32px);
    }

    /* Form inputs stack */
    .tbc-input, .tbc-select {
        font-size: 16px; /* prevents iOS zoom */
    }

    .tbc-toast {
        bottom: 16px;
        left: 16px;
        right: 16px;
        transform: none;
        max-width: none;
    }

    @keyframes tbc-slide-in {
        from { transform: translateY(20px); opacity: 0; }
        to { transform: translateY(0); opacity: 1; }
    }
}

/* --- Very small screens --- */
@media (max-width: 380px) {
    #tbc-app {
        padding: 8px;
    }

    .tbc-week-header {
        padding: 10px 12px;
    }

    .tbc-entry,
    .tbc-edit-card {
        padding: 12px;
    }

    .tbc-btn-add {
        margin: 8px 12px;
        width: calc(100% - 24px);
    }
}

/* --- 2.0: a week marked paid on the board is closed; small notes --- */
.tbc-week-badge-paid {
    background: var(--tbc-success);
}

.tbc-week-note {
    padding: 10px 20px 14px;
    font-size: 13px;
    color: var(--tbc-muted);
}

.tbc-form-hint {
    font-size: 13px;
    color: var(--tbc-muted);
    margin: 0 0 12px 0;
}

.tbc-btn[disabled] {
    opacity: 0.6;
    cursor: default;
}
