:root {
    --bg-color: #ffffff;
    --bg-secondary: #f9f9f9;
    --text-color: #333;
    --border-color: #ddd;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#app {
    width: 100%;
    max-width: 500px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

h1 {
    text-align: center;
    margin-bottom: 20px;
}

header {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
    position: relative;
}

header h1 {
    margin-bottom: 5px;
}

header p {
    margin: 5px 0;
}

.header-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
    gap: 10px;
    margin-top: 5px;
    width: 100%;
}

.menu-wrapper {
    position: relative;
}

.logout-btn,
.menu-btn {
    min-height: 48px;
    padding: 8px 16px;
}

.logout-btn {
    background-color: #f44336;
}

.logout-btn:hover {
    background-color: #d32f2f;
}

.menu-btn {
    background-color: #2196F3;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.menu-btn:hover {
    background-color: #0b7dda;
}

.menu-btn .dropdown-arrow {
    font-size: 16px;
    margin-left: 8px;
}

.menu-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 10;
    min-width: 200px;
    max-width: calc(100vw - 40px);
    margin-top: 5px;
}

.menu-dropdown.open {
    display: block;
}

.menu-dropdown button {
    width: 100%;
    text-align: left;
    background-color: #2196F3;
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 16px;
    min-height: 48px;
    margin-bottom: 4px;
}

.menu-dropdown button:last-child {
    margin-bottom: 0;
}

.menu-dropdown button:hover {
    background-color: #0b7dda;
    color: white;
}

.menu-dropdown button.menu-logout {
    color: #dc3545;
    font-weight: bold;
}

.admin-tabs {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.back-btn {
    align-self: flex-start;
    background: none;
    border: none;
    color: #2196F3;
    font-size: 16px;
    cursor: pointer;
    padding: 8px;
    margin-bottom: 10px;
}

form {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
}

label {
    margin-bottom: 5px;
    font-weight: 600;
}

input,
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 16px;
    min-height: 48px;
    width: 100%;
    box-sizing: border-box;
}

button:hover {
    background-color: #45a049;
}

.error {
    color: red;
    text-align: center;
}

.status {
    text-align: center;
    margin-top: 10px;
}

.punch-card, .admin-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
}

.weekly-summary {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 15px;
}

.weekly-summary-button {
    background: transparent;
    border: none;
    color: #2e7d32;
    font-size: 20px;
    font-weight: 600;
    padding: 0;
    margin: 0;
    text-align: left;
    width: 100%;
    cursor: pointer;
    min-height: 48px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.weekly-summary-button:hover {
    background-color: rgba(0,0,0,0.05);
    border-radius: 4px;
}

.dropdown-arrow {
    font-size: 14px;
    margin-left: 8px;
    transition: transform 0.2s ease;
}

.weekly-summary p {
    margin: 5px 0;
    font-weight: 500;
}

.weekly-entries-container {
    margin-top: 10px;
}

.weekly-entry-item {
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

.weekly-entry-view {
    display: block;
}

.weekly-entry-edit {
    display: none;
}

.entry-line {
    margin: 4px 0;
}

.entry-header strong {
    display: block;
    font-size: 16px;
    margin-bottom: 6px;
}

.entry-label {
    font-weight: 600;
    display: inline-block;
    width: 70px;
}

.edit-entry-btn {
    background-color: #2196F3;
    margin-top: 8px;
    width: 100%;
}

.edit-entry-btn:hover {
    background-color: #0b7dda;
}

.edit-field {
    margin-bottom: 10px;
}

.edit-field label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

.edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.edit-actions button {
    flex: 1;
}

.save-edit-btn {
    background-color: #4CAF50;
}

.save-edit-btn:hover {
    background-color: #45a049;
}

.cancel-edit-btn {
    background-color: #9e9e9e;
}

.cancel-edit-btn:hover {
    background-color: #757575;
}

.active-punch-card {
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 12px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
}

.active-punch-info {
    margin-bottom: 8px;
}

.active-punch-info strong {
    font-size: 16px;
    display: block;
    margin-bottom: 4px;
}

.notes-input-container {
    margin-bottom: 8px;
}

.notes-input-container label {
    display: block;
    font-size: 14px;
    margin-bottom: 4px;
}

.punch-notes-input {
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

.punch-out-btn {
    background-color: #f44336;
    margin-top: 5px;
}

.punch-out-btn:hover {
    background-color: #d32f2f;
}

#last-punch-out-details {
    background: white;
    border: 1px solid #ccc;
    border-radius: 5px;
    padding: 12px;
}

#last-punch-out-details p {
    margin: 8px 0;
}

/* Admin user management action dropdown */
.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    border-bottom: 1px solid #eee;
    position: relative;
}

.manage-wrapper {
    position: relative;
}

.manage-btn {
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    min-height: 44px;
    padding: 8px 12px;
}

.manage-btn:hover {
    background-color: #e0e0e0;
}

.manage-dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    z-index: 20;
    display: none;
    min-width: 160px;
}

.manage-dropdown-menu.open {
    display: block;
}

.manage-menu-item {
    width: 100%;
    text-align: left;
    background: white;
    color: #333;
    border: none;
    padding: 10px;
    cursor: pointer;
    font-size: 16px;
    min-height: 48px;
}

.manage-menu-item:hover {
    background-color: #f5f5f5;
}

.locked-user {
    text-decoration: line-through;
    opacity: 0.6;
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay.show {
    display: flex;
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 400px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.modal-actions button {
    flex: 1;
}

/* Job management styles */
.job-status {
    font-weight: 600;
    text-transform: capitalize;
}

.job-status.active {
    color: green;
}

.job-status.inactive {
    color: #999;
}

.job-assigned-info {
    font-size: 14px;
    color: #666;
}

/* Interactive user pills */
.user-pills-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.user-pill {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 16px;
    background: #e0e0e0;
    color: #333;
    cursor: pointer;
    margin: 0 4px 4px 0;
    border: 1px solid #ccc;
    font-size: 14px;
    user-select: none;
}

.user-pill.active {
    background: #4CAF50;
    color: white;
    border-color: #388E3C;
}

.user-pill.inactive {
    background: #f5f5f5;
    color: #333;
}

.user-pill:hover {
    opacity: 0.85;
}

/* Company accordion base styles */
.company-row {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.company-expanded-details {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    color: var(--text-color);
}

.company-admin-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    color: var(--text-color);
}

.company-admin-list {
    color: var(--text-color);
}

/* Dark mode overrides */
body.dark-mode {
    --bg-color: #1e1e1e;
    --bg-secondary: #242424;
    --text-color: #e0e0e0;
    --border-color: #444;
    background-color: #121212;
    color: #e0e0e0;
}

body.dark-mode #app {
    background: #1e1e1e;
    color: #e0e0e0;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode label,
body.dark-mode p,
body.dark-mode .entry-line,
body.dark-mode .entry-label,
body.dark-mode .job-status,
body.dark-mode .job-assigned-info {
    color: #e0e0e0;
}

body.dark-mode input,
body.dark-mode select {
    background-color: #333;
    color: #eee;
    border-color: #555;
}

body.dark-mode .menu-dropdown,
body.dark-mode .manage-dropdown-menu {
    background: #1e1e1e;
    border-color: #444;
}

body.dark-mode .menu-dropdown button,
body.dark-mode .manage-menu-item {
    background-color: #2a2a2a;
    color: #eee;
}

body.dark-mode .menu-dropdown button:hover,
body.dark-mode .manage-menu-item:hover {
    background-color: #3a3a3a;
}

body.dark-mode .punch-card,
body.dark-mode .admin-card,
body.dark-mode .weekly-summary {
    background: #242424;
    border-color: #444;
}

body.dark-mode .weekly-summary {
    background: #1e2a1e;
    border-color: #2e3a2e;
}

body.dark-mode .weekly-summary-button {
    color: #8bc34a;
}

body.dark-mode .active-punch-card,
body.dark-mode .weekly-entry-item,
body.dark-mode #last-punch-out-details {
    background: #1e1e1e;
    border-color: #444;
}

body.dark-mode .job-status.active {
    color: #81c784;
}

body.dark-mode .job-status.inactive {
    color: #999;
}

body.dark-mode .user-pill {
    background: #333;
    color: #eee;
    border-color: #555;
}

body.dark-mode .user-pill.active {
    background: #388E3C;
    color: white;
    border-color: #2E7D32;
}

body.dark-mode .user-pill.inactive {
    background: #424242;
    color: #ccc;
}

/* Additional dark mode overrides for company management and admin sections */
body.dark-mode .company-row {
    background: var(--bg-color) !important;
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .company-collapsed-header {
    background: var(--bg-color) !important;
    color: var(--text-color);
}

body.dark-mode .company-expanded-details {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .company-admin-section {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .company-admin-list {
    background: var(--bg-secondary) !important;
    color: var(--text-color);
}

body.dark-mode .job-row {
    background: var(--bg-color) !important;
    border-color: var(--border-color);
    color: var(--text-color);
}

body.dark-mode .job-collapsed-header {
    background: var(--bg-color) !important;
    color: var(--text-color);
}

body.dark-mode .job-expanded-details {
    background: var(--bg-secondary) !important;
    border-color: var(--border-color);
    color: var(--text-color);
}
