/* Combined styles for TraqR application */

/* --- Variables and Base Styles --- */
:root {
    --primary-color: #007bff; --secondary-color: #6c757d; --success-color: #28a745; --danger-color: #dc3545;
    --warning-color: #ffc107; --info-color: #17a2b8; --light-color: #f8f9fa; --dark-color: #343a40;
    --border-color: #dee2e6; --body-bg: #fff; --text-color: #212529; --link-color: var(--primary-color);
    --font-family-sans-serif: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --border-radius: 0.25rem; --box-shadow-sm: 0 .125rem .25rem rgba(0, 0, 0, .075); --box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15);
}
body { font-family: var(--font-family-sans-serif); margin: 0; background-color: var(--light-color); color: var(--text-color); line-height: 1.5; }
.container { max-width: 1140px; margin: 0 auto; padding: 15px; }
h1, h2, h3, h4 { margin-top: 1.5rem; margin-bottom: 0.75rem; font-weight: 500; color: var(--dark-color); }
h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; } h3 { font-size: 1.5rem; } h4 { font-size: 1.25rem; }
a { color: var(--link-color); text-decoration: none; } a:hover { text-decoration: underline; }
hr { margin: 1.5rem 0; border: 0; border-top: 1px solid var(--border-color); }

/* --- User Navigation --- */
.user-nav {
    background-color: var(--body-bg); padding: 10px 20px; border-bottom: 1px solid var(--border-color); margin-bottom: 1rem;
    box-shadow: var(--box-shadow-sm); display: flex; align-items: center; font-size: 0.9em; gap: 15px; flex-wrap: wrap;
}
.nav-left { display: flex; align-items: center; gap: 10px; }
.navbar-logo { height: 1.4em; /* Match brand font-size */ width: auto; vertical-align: middle; }
.navbar-brand { font-size: 1.4em; font-weight: bold; color: var(--dark-color); text-decoration: none; line-height: 1; margin-right: auto; }
.navbar-brand:hover { text-decoration: none; color: var(--primary-color); }
.navbar-page-title { font-size: 1.1em; color: var(--secondary-color); font-weight: 300; line-height: 1; }
.user-nav-right { margin-left: auto; white-space: nowrap; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-nav-right span { margin-right: 8px; }
.user-nav-right .button-link { line-height: 1.4; vertical-align: middle; }

/* --- Flash Messages --- */
.flash-messages { margin-bottom: 1rem; }
.message { padding: 0.75rem 1.25rem; margin-bottom: 1rem; border: 1px solid transparent; border-radius: var(--border-radius); }
.success { color: #0f5132; background-color: #d1e7dd; border-color: #badbcc; } .error { color: #842029; background-color: #f8d7da; border-color: #f5c2c7; }
.warning { color: #664d03; background-color: #fff3cd; border-color: #ffecb5; } .info { color: #055160; background-color: #cff4fc; border-color: #b6effb; }
/* --- Buttons --- */
button, .button-link { display: inline-block; font-weight: 400; line-height: 1.5; color: var(--text-color); text-align: center; vertical-align: middle; cursor: pointer; user-select: none; background-color: transparent; border: 1px solid transparent; padding: 0.375rem 0.75rem; font-size: 1rem; border-radius: var(--border-radius); transition: color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out; text-decoration: none !important; }
button:hover, .button-link:hover { text-decoration: none !important; }
button.primary, .button-link.primary { color: #fff; background-color: var(--primary-color); border-color: var(--primary-color); } button.primary:hover, .button-link.primary:hover { background-color: #0056b3; border-color: #0056b3; }
button.danger, .button-link.danger { color: #fff; background-color: var(--danger-color); border-color: var(--danger-color); } button.danger:hover, .button-link.danger:hover { background-color: #b02a37; border-color: #b02a37; }
button.secondary, .button-link.secondary { color: #fff; background-color: var(--secondary-color); border-color: var(--secondary-color); } button.secondary:hover, .button-link.secondary:hover { background-color: #545b62; border-color: #545b62; }
button.success, .button-link.success { color: #fff; background-color: var(--success-color); border-color: var(--success-color); } button.success:hover, .button-link.success:hover { background-color: #218838; border-color: #1e7e34; }
button.sm, .button-link.sm { padding: 0.25rem 0.5rem; font-size: .875rem; border-radius: 0.2rem; }
button[type="submit"] { color: #fff; background-color: var(--primary-color); border-color: var(--primary-color); } button[type="submit"]:hover { background-color: #0056b3; border-color: #0056b3; }
.delete-form { display: inline-block; margin-left: 5px; vertical-align: middle; }
.delete-form button { background-color: var(--danger-color); color: white; border: none; padding: 0.25rem 0.5rem; font-size: .875rem; cursor: pointer; border-radius: 0.2rem; } .delete-form button:hover { background-color: #b02a37; }
/* --- Forms --- */
form div { margin-bottom: 0.75rem; } label { display: inline-block; margin-bottom: 0.5rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="datetime-local"], input[type="date"], select, textarea { display: block; width: 100%; padding: 0.375rem 0.75rem; font-size: 1rem; font-weight: 400; line-height: 1.5; color: var(--text-color); background-color: #fff; background-clip: padding-box; border: 1px solid #ced4da; border-radius: var(--border-radius); transition: border-color .15s ease-in-out,box-shadow .15s ease-in-out; box-sizing: border-box; }
input:focus, select:focus, textarea:focus { border-color: #86b7fe; outline: 0; box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, .25); }
.action-button-row { margin-top: 1rem; }
/* --- Auth Form Specific Styles --- */
.auth-form { max-width: 450px; margin: 40px auto; padding: 1.5rem; border: 1px solid var(--border-color); border-radius: var(--border-radius); background-color: #fff; box-shadow: var(--box-shadow); }
.auth-form h1 { text-align: center; margin-top: 0; margin-bottom: 1.5rem; }
.auth-form form div:not(.action-button-row):not(.remember-me):not(.forgot-password-link):not(.form-link) { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth-form form label { flex-basis: 100px; flex-shrink: 0; text-align: right; margin-bottom: 0; }
.auth-form form input[type="text"], .auth-form form input[type="email"], .auth-form form input[type="password"], .auth-form form select { flex-grow: 1; width: auto; display: inline-block; }
.auth-form .remember-me { display: flex; align-items: center; margin-bottom: 1rem; padding-left: 110px; }
.auth-form .remember-me input[type="checkbox"] { width: auto; margin-right: 0.5rem; display: inline-block; } .auth-form .remember-me label { flex-basis: auto; text-align: left; margin-bottom: 0; }
.auth-form .forgot-password-link { text-align: right; font-size: 0.85em; margin-top: -0.5rem; margin-bottom: 1rem; padding-right: 0; }
.auth-form .action-button-row { text-align: center; } .auth-form .action-button-row button { width: 100%; max-width: 250px; }
.auth-form .form-link { text-align: center; margin-top: 1rem; font-size: 0.9em; }
/* --- Tables --- */
.table-container { overflow-x: auto; } table { width: 100%; border-collapse: collapse; margin: 1rem 0; background-color: #fff; box-shadow: var(--box-shadow-sm); border-radius: var(--border-radius); overflow: hidden; }
th, td { border: 1px solid var(--border-color); padding: 0.75rem; text-align: left; vertical-align: middle; border-left: none; border-right: none; }
th { background-color: var(--light-color); font-weight: bold; border-bottom-width: 2px; border-top: none; } td { border-top: none; }
tbody tr:last-child td { border-bottom: none; } tbody tr:nth-of-type(odd) { background-color: rgba(0, 0, 0, 0.03); }
td.notes { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } td.notes:hover { white-space: normal; overflow: visible; }
td .entry-actions-cell { display: flex; align-items: center; gap: 5px; justify-content: flex-start; white-space: nowrap; }
td .edit-link { margin-right: 0; }


/* --- Index Page Specific Layout --- */
.dashboard-section { background-color: #fff; padding: 1.5rem; border-radius: var(--border-radius); box-shadow: var(--box-shadow-sm); }
.dashboard-section h2, .dashboard-section h3 { margin-top: 0; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; margin-bottom: 1rem; }
.top-dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px; align-items: start; }
.dashboard-column-2-content { display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 992px) { .top-dashboard-row { grid-template-columns: 1fr; } }
.top-dashboard-row .dashboard-section { /* Inherits general styles */ }
.timer-section h2 { margin-bottom: 1rem; }
.start-timer-form label { display: block; margin-bottom: 0.25rem; }
.start-timer-form .action-button-row { margin-top: 0.5rem; }
.timer-actions { display: flex; gap: 0.5rem; align-items: center; }
.timer-actions button, .timer-actions .button-link { margin-left: 0 !important; }
.active-timer-list { margin-top: 1.5rem; }
.active-timer-list h3 { font-size: 1.3rem; margin-bottom: 0.8rem; }
.active-timer-list-item { border: 1px solid var(--info-color); padding: 1rem 1.25rem; background-color: #cff4fc; border-radius: var(--border-radius); margin-bottom: 1rem; position: relative; }
.active-timer-list-item p { margin-bottom: 0.5rem; line-height: 1.4; display: block; }
.active-timer-list-item strong { display: inline-block; width: 70px; font-weight: bold; color: var(--secondary-color); vertical-align: top; margin-right: 5px; text-align: right; }
.active-timer-list-item p span { word-break: break-word; vertical-align: top; }
.active-timer-list-item p .elapsed-time-display { font-weight: bold; font-size: 1.1em; color: var(--dark-color); margin-left: 5px; }
.active-timer-list-item p:has(strong:contains("Notes")) span { white-space: normal; word-break: break-word; }
.active-timer-list-item .stop-timer-form { position: absolute; top: 1rem; right: 1rem; margin: 0; }
.stats-toggle-controls { margin-bottom: 1rem; padding: 0.5rem; background-color: var(--light-color); border-radius: var(--border-radius); text-align: center; font-size: 0.9em; }
.stats-toggle-button { padding: 0.3rem 0.6rem; font-size: 0.9em; margin-left: 5px; cursor: pointer; border: 1px solid var(--border-color); background-color: #fff; color: var(--primary-color); border-radius: var(--border-radius); opacity: 0.7; transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out, opacity 0.15s ease-in-out; }
.stats-toggle-button.active { background-color: var(--primary-color); color: #fff; font-weight: bold; border-color: var(--primary-color); opacity: 1.0; }
.stats-toggle-button:not(.active):hover { background-color: #e9ecef; opacity: 0.9; }
#graphStatsSection { /* Shown by default via JS */ }
.stats-graphs-section h2 { margin-bottom: 0.5rem; }
.graph-options { display: flex; flex-wrap: wrap; gap: 15px; margin-bottom: 1.5rem; align-items: center; }
.graph-options label { margin-bottom: 0; font-weight: bold; font-size: 0.9em; margin-right: 5px; }
.graph-options select { display: inline-block; width: auto; padding: 0.25rem 0.5rem; font-size: 0.9em; flex-grow: 1; max-width: 150px; }
.charts-area { display: flex; flex-direction: column; gap: 2rem; }
.chart-container { position: relative; max-height: 350px; width: 100%; }
#textStatsSection { display: none; /* Hidden by default, shown via JS */ }
.stats-text-section h2 { margin-bottom: 1rem; }
.stats-text-section .stat-item { display: flex; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px dashed var(--border-color); font-size: 1.1em; }
.stats-text-section .stat-item:last-child { border-bottom: none; }
.stats-text-section .stat-label { font-weight: 500; color: var(--secondary-color); }
.stats-text-section .stat-value { font-weight: bold; color: var(--dark-color); }
.recent-entries-compact { padding: 1.25rem; margin-top: 0; }
.recent-entries-compact h2 { font-size: 1.3rem; padding-bottom: 0.4rem; margin-bottom: 0.8rem; }
.compact-entry-list { list-style: none; padding: 0; margin: 0; }
.compact-entry-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.4rem 0; border-bottom: 1px solid var(--border-color); gap: 8px; font-size: 0.9em; }
.compact-entry-list li:last-child { border-bottom: none; }
.compact-entry-list .entry-date { flex-basis: 75px; flex-shrink: 0; color: var(--secondary-color); font-size: 0.85em; }
.compact-entry-list .entry-cp-task { flex-grow: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact-entry-list .entry-owner { font-size: 0.85em; color: var(--secondary-color); margin-left: 4px; }
.compact-entry-list .entry-duration { flex-basis: 65px; flex-shrink: 0; text-align: right; font-weight: bold; color: var(--dark-color); }
.recent-entries-compact .view-all-link { text-align: right; margin-top: 0.8rem; font-size: 0.85em; }

/* Management Area */
.management-area { display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 1.5rem; }
.management-section { background-color: #fff; padding: 1.5rem; border-radius: var(--border-radius); box-shadow: var(--box-shadow-sm); }
.management-section h3 { margin-top: 0; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; margin-bottom: 1rem; }
.management-section h4 { margin-top: 0; margin-bottom: 0.75rem; font-size: 1.1rem; font-weight: 500; }
.add-form label { display: block; margin-bottom: 0.25rem; } .add-form .action-button-row { margin-top: 0.5rem; }
.existing-list { margin-top: 1.5rem; } .existing-list ul { list-style: none; padding: 0; margin: 0; }
.existing-list li { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 0; border-bottom: 1px solid var(--border-color); }
.existing-list li:last-child { border-bottom: none; } .existing-list li span { flex-grow: 1; margin-right: 10px; }
.existing-list .delete-form { margin-left: 10px; } .existing-list .delete-form button { padding: 0.25rem 0.5rem; font-size: .875rem; }

/* --- Report Page Styles --- */
.report-filters { background-color: #fff; padding: 1.5rem; border-radius: var(--border-radius); box-shadow: var(--box-shadow-sm); margin-bottom: 1.5rem; display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; }
.report-filters .filter-group { flex: 1 1 180px; min-width: 150px; }
.report-filters label { display: block; margin-bottom: 0.25rem; font-weight: bold; font-size: 0.9em; }
.report-filters .button-group { flex-basis: 100%; display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.5rem; padding-top: 0.5rem; }
.report-summary { font-weight: bold; margin: 1.5rem 0; text-align: right; padding: 0.75rem 1.25rem; background-color: var(--light-color); border: 1px solid var(--border-color); border-radius: var(--border-radius); }
.report-results { background-color: #fff; padding: 0 1.5rem 1.5rem 1.5rem; margin-top: 1.5rem; border-radius: var(--border-radius); box-shadow: var(--box-shadow-sm); }
.report-results h2 { margin-top: 0; padding-top: 1.5rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; margin-bottom: 1rem; }

/* --- Links --- */
.back-link, .back-link-admin { margin-top: 1.5rem; display: block; text-align: center; }
/* --- Admin Users Table --- */
.admin-container { max-width: 1100px; margin: 20px auto; padding: 1.5rem; background-color: #fff; border-radius: var(--border-radius); box-shadow: var(--box-shadow); }
.admin-actions { margin-bottom: 1.5rem; text-align: right; }
.admin-table { width: 100%; margin: 1.5rem 0; }
.admin-table th, .admin-table td { padding: 0.75rem; vertical-align: middle; }
.admin-table form { display: inline-flex; align-items: center; gap: 5px; margin: 0 5px 0 0; }
.admin-table select { padding: 5px; min-width: 110px; height: auto; font-size: 0.9em; display: inline-block; width: auto; }
.admin-table button { font-size: 0.9em; padding: 5px 10px; height: auto; }
.status-active { color: var(--success-color); font-weight: bold; }
.status-inactive { color: var(--danger-color); font-weight: bold; }
.action-lock { background-color: var(--warning-color); border-color: var(--warning-color); color: #000; }
.action-lock:hover { background-color: #d39e00; border-color: #d39e00; }
.action-unlock { background-color: var(--success-color); border-color: var(--success-color); color: #fff; }
.action-unlock:hover { background-color: #1d8134; border-color: #1d8134; }
.action-delete { background-color: var(--danger-color); border-color: var(--danger-color); color: #fff; }
.action-delete:hover { background-color: #b02a37; border-color: #b02a37; }
/* --- Graphical Form Toggle Switch --- */
.form-switch-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
}
.form-switch {
    display: inline-flex;
    border: 1px solid var(--primary-color);
    border-radius: var(--border-radius);
    overflow: hidden;
}
.form-switch input[type="radio"] {
    display: none; /* Hide the actual radio button */
}
.form-switch label {
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--primary-color);
    background-color: #fff;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
    text-align: center;
    min-width: 100px;
    margin-bottom: 0; /* Override global label margin */
}
.form-switch input[type="radio"]:checked + label {
    background-color: var(--primary-color);
    color: white;
    font-weight: bold;
}
.form-switch label:not(:last-of-type) {
    border-right: 1px solid var(--primary-color);
}
/* --- Print Styles --- */
@media print {
    body { background-color: #fff !important; color: #000 !important; margin: 1cm; font-size: 10pt; }
    .user-nav, .report-filters, .flash-messages, .back-link, .back-link-admin, .admin-actions,
    .timer-section .start-timer-form .timer-actions, .management-area .add-form, .management-area .existing-list .delete-form,
    button:not(.no-print), a.button-link:not(.no-print), .admin-table form,
    .recent-entries-compact .view-all-link, .entry-actions-cell a, .entry-actions-cell form, .navbar-page-title,
    .active-timer-list-item .stop-timer-form,
    .stats-toggle-controls, /* Hide toggle */
    .graph-options, .charts-area, .chart-container /* Hide graphs */
     { display: none !important; }
    #textStatsSection { display: block !important; } /* Ensure text stats show in print */

    .container { max-width: 100% !important; margin: 0 !important; padding: 0 !important; box-shadow: none !important; border: none !important; }
    .dashboard-grid, .management-area { display: block !important; }
    .top-dashboard-row { display: block !important; }
     .dashboard-column-2-content { display: block !important; }
    .dashboard-section, .management-section, .report-results, .admin-container, .recent-entries-compact, .stats-graphs-section, .stats-text-section { box-shadow: none !important; border: none !important; padding: 0 !important; margin: 0 0 1rem 0 !important; background-color: transparent !important; }
    h1 { font-size: 16pt; text-align: center; margin-bottom: 1rem; }
    .report-results h2, .admin-container h1, .recent-entries-compact h2, .active-timer-list h3, .stats-graphs-section h2, .stats-text-section h2 { font-size: 14pt; text-align: center; border-bottom: 1px solid #ccc; padding-bottom: 0.25rem; margin-bottom: 0.75rem; }
    .report-summary { text-align: right; font-size: 11pt; margin: 0.5rem 0 1rem 0; border: none !important; background-color: transparent !important; padding: 0 !important; }
    .table-container { overflow: visible !important; }
    table { width: 100% !important; border-collapse: collapse !important; box-shadow: none !important; border-radius: 0 !important; margin-top: 0.5rem !important; font-size: 9pt; }
    th, td { border: 1px solid #aaa !important; padding: 4px 6px !important; color: #000 !important; background-color: transparent !important; vertical-align: top; }
    th { background-color: #eee !important; font-weight: bold; border-bottom-width: 1px !important; }
    tbody tr:nth-of-type(odd) { background-color: transparent !important; }
    td.notes { max-width: none !important; white-space: normal !important; overflow: visible !important; }
    .compact-entry-list { font-size: 9pt; }
    a[href]::after { content: none !important; }
    table, tr, td, th, tbody, thead, tfoot { page-break-inside: avoid !important; }
    thead { display: table-header-group; }
}
/* --- End Print Styles --- */