/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
  --primary-color: #4361ee;
  --secondary-color: #3f37c9;
  --light-color: #f8f9fa;
  --dark-color: #212529;
  --gray-color: #6c757d;
  --light-gray: #e9ecef;
  --danger-color: #e63946;
  --success-color: #06d6a0;
}

/* Gray theme */
:root.theme-gray {
  --primary-color: #666666;
  --secondary-color: #555555;
  --light-color: #f5f5f5;
  --dark-color: #333333;
  --gray-color: #777777;
  --light-gray: #e0e0e0;
  --danger-color: #888888;
  --success-color: #999999;
}

/* Gray theme specific overrides */
.theme-gray .color-dot {
  filter: grayscale(100%);
}

.theme-gray .task-block {
  background-color: var(--gray-color) !important;
  filter: none !important;
}

.theme-gray .week-table th {
  background-color: var(--primary-color) !important;
}

.theme-gray .week-table th:first-child {
  background-color: var(--secondary-color) !important;
}

.theme-gray .week-table th:hover {
  background-color: var(--secondary-color) !important;
}

.theme-gray .edit-btn {
  color: var(--gray-color) !important;
  background-color: rgba(119, 119, 119, 0.04) !important;
}

.theme-gray .edit-btn:hover {
  background-color: rgba(119, 119, 119, 0.08) !important;
  color: var(--dark-color) !important;
}

.theme-gray .delete-btn {
  color: var(--gray-color) !important;
  background-color: rgba(119, 119, 119, 0.04) !important;
}

.theme-gray .delete-btn:hover {
  background-color: rgba(119, 119, 119, 0.08) !important;
  color: var(--dark-color) !important;
}

/* Dashboard gray theme overrides */
.theme-gray .dashboard-header .prev-btn,
.theme-gray .dashboard-header .next-btn {
  color: var(--gray-color) !important;
}

.theme-gray .activity-section h3,
.theme-gray .projects-section h3 {
  color: var(--gray-color) !important;
}

.theme-gray .project-color {
  filter: grayscale(100%);
}

.theme-gray .progress-your-time {
  background-color: var(--gray-color) !important;
}

body {
  background-color: var(--light-color);
  color: var(--dark-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
}

/* Common elements */
h1, h2, h3 {
  margin-bottom: 1rem;
  color: var(--dark-color);
}

a {
  color: var(--primary-color);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.btn {
  display: inline-block;
  padding: 0.5rem 1rem;
  background-color: var(--light-gray);
  color: var(--dark-color);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.btn:hover {
  background-color: #dee2e6;
  text-decoration: none;
}

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

.btn-primary:hover {
  background-color: var(--secondary-color);
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background-color: #c62828;
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-success:hover {
  background-color: #059669;
}

.btn-outline-primary {
  background-color: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

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

.btn-block {
  display: block;
  width: 100%;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
}

.alert {
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 4px;
}

.alert-success {
  color: #155724;
  background-color: #d4edda;
  border-color: #c3e6cb;
}

.alert-danger {
  color: #721c24;
  background-color: #f8d7da;
  border-color: #f5c6cb;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--light-gray);
  border-radius: 4px;
  font-size: 1rem;
}

.form-control:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 0.2rem rgba(67, 97, 238, 0.25);
}

.form-actions {
  margin-top: 1.5rem;
}

/* Layout */
header {
  background-color: var(--primary-color);
  color: white;
  padding: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-container {
  display: flex;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.header-title {
  color: white;
  margin-bottom: 0;
  margin-left: 1rem;
}

.hamburger-menu {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

main {
  display: flex;
  flex-grow: 1;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.sidebar {
  width: 250px;
  background-color: white;
  padding: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  overflow-y: auto;
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.sidebar.active {
  transform: translateX(0);
}

.sidebar-header {
  display: flex;
  justify-content: flex-end;
  padding: 1rem;
  background-color: var(--primary-color);
}

.close-sidebar {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
}

.sidebar nav {
  padding: 1.5rem 1rem;
}

.content {
  flex-grow: 1;
  padding: 1.5rem;
  width: 100%;
  min-height: calc(100vh - 60px);
}

/* Navigation */
.sidebar nav ul {
  list-style: none;
  padding: 0;
}

.sidebar nav .company-info {
  padding: 0.5rem 1rem 1rem;
  border-bottom: 1px solid var(--light-gray);
  margin-bottom: 1rem;
}

.sidebar nav .company-info h4 {
  color: var(--primary-color);
  margin-bottom: 0;
  font-size: 1.1rem;
}

.sidebar nav ul li {
  margin-bottom: 0.5rem;
}

.sidebar nav ul li a {
  display: block;
  padding: 0.5rem;
  color: var(--dark-color);
  border-radius: 4px;
  transition: background-color 0.2s;
}

.sidebar nav ul li a:hover {
  background-color: var(--light-gray);
  text-decoration: none;
}

.sidebar nav ul li .nav-button {
  width: 100%;
  text-align: left;
  padding: 0.5rem;
  background: none;
  border: none;
  color: var(--danger-color);
  cursor: pointer;
  border-radius: 4px;
}

.sidebar nav ul li .nav-button:hover {
  background-color: var(--light-gray);
}

.sidebar nav ul li.nav-section {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gray-color);
  padding: 0.5rem;
  margin-bottom: 0.5rem;
}

.sidebar nav ul li.nav-divider {
  height: 1px;
  background-color: var(--light-gray);
  margin: 1rem 0;
}

/* Dashboard */
.dashboard-container {
  display: flex;
  gap: 1.5rem;
}

.dashboard-section {
  flex: 1;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
}

.dashboard-sidebar {
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.log-time-card, .today-summary-card {
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  padding: 1.5rem;
}

/* Week table */
.week-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  width: 100%;
}


.week-navigation h3 {
  margin-bottom: 0.25rem;
  color: var(--primary-color);
  text-align: center;
  font-size: 1.2rem;
}

.view-options {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.bottom-options {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}

.view-option {
  width: 30px;
  height: 30px;
  padding: 0;
  font-size: 0.9rem;
  font-weight: bold;
  background-color: var(--light-gray);
  color: var(--gray-color);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.view-option:hover {
  background-color: #d0d6dc;
}

.view-option.active {
  background-color: var(--primary-color);
  color: white;
}

.week-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 0.2rem;
}

.week-table th, .week-table td {
  border: 1px solid var(--light-gray);
  padding: 8px;
  text-align: center;
}

.week-table th {
  background-color: var(--primary-color);
  color: white;
  padding: 12px 8px;
  cursor: pointer;
}

.week-table th:hover {
  background-color: var(--secondary-color);
}

.week-table th:first-child {
  background-color: var(--secondary-color);
  cursor: default;
}

.hour-cell {
  background-color: #f1f3f5;
  font-weight: bold;
  text-align: right;
  padding-right: 10px !important;
  width: 80px;
  height: 60px;
}

.time-slot {
  position: relative;
  vertical-align: top;
  cursor: pointer;
  height: 60px;
}

.time-slot:hover {
  background-color: #f1f3f5;
}

.time-slot.selected-day {
  background-color: #e6f7ff;
  border: 2px solid var(--primary-color);
}

/* Task blocks */
.task-block {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 4px;
  padding: 6px;
  font-size: 0.8rem;
  color: white;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 5;
  text-align: left;
  transition: all 0.2s;
}

.task-block:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  filter: brightness(1.05);
  transform: translateY(-2px);
}

/* Project items */
.project-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Entry summary */
.entry-summary {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--light-gray);
}

.entry-summary ul {
  list-style: none;
  padding-left: 1rem;
  margin-top: 0.5rem;
}

.entry-summary ul li {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

/* Timer */
.timer-display {
  font-size: 1.5rem;
  text-align: center;
  margin: 1rem 0;
  font-weight: bold;
  font-family: monospace;
}

.timer-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.timer-controls button {
  flex: 1;
}

/* Date display */
.date-display {
  background-color: #f1f3f5;
  padding: 8px;
  border-radius: 4px;
  text-align: center;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

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

.modal-content {
  background-color: white;
  padding: 1.5rem;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.close-modal {
  font-size: 1.5rem;
  cursor: pointer;
  background: none;
  border: none;
  color: var(--dark-color);
}

/* Authentication */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-form-container {
  width: 100%;
  max-width: 400px;
  background-color: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 2rem;
}

.auth-form-container h1 {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-links {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
}

/* Color picker styles */
.color-picker {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  border: 1px solid var(--light-gray);
}

.color-picker::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker::-webkit-color-swatch {
  border: none;
  border-radius: 50%;
}

.color-picker::-moz-color-swatch {
  border: none;
  border-radius: 50%;
}

/* Responsive styles */
@media (max-width: 992px) {
  .dashboard-container {
    flex-direction: column;
  }
  
  .dashboard-sidebar {
    width: 100%;
  }
}

/* Mobile/Desktop view controls */
.mobile-only {
  display: none;
}

.desktop-only {
  display: inline-block;
}

/* Desktop-specific navigation layout */
@media (min-width: 769px) {
  .week-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    width: 100%;
  }
  
  .week-navigation > div {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
  
  .week-navigation > button {
    flex-shrink: 0;
  }
}

@media (max-width: 768px) {
  .mobile-only {
    display: inline-block;
  }
  
  .desktop-only {
    display: none;
  }
  
  .content {
    padding: 1rem;
  }
  
  .week-table th, .week-table td {
    padding: 6px 4px;
    font-size: 0.9rem;
  }
  
  .hour-cell {
    width: 60px;
  }
  
  /* Ensure proper layout on mobile */
  .dashboard-container {
    flex-direction: column;
    gap: 1rem;
  }
  
  .dashboard-section {
    width: 100%;
    margin-bottom: 1rem;
  }
  
  .dashboard-sidebar {
    width: 100%;
    order: 2;
  }
  
  /* Mobile sidebar - simple approach */
  .dashboard-sidebar {
    display: block;
  }
  
  /* Add overlay when menu is open */
  .sidebar.active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
  }
  
  /* Mobile form improvements */
  .form-control {
    font-size: 16px; /* Prevents iOS zoom */
    min-height: 44px; /* Touch target size */
  }
  
  .btn {
    min-height: 44px; /* Touch target size */
    padding: 0.75rem 1rem;
  }
  
  /* Better form layout */
  .form-row {
    flex-direction: column;
    gap: 1rem;
  }
  
  .form-row > * {
    width: 100% !important;
  }
}

@media (max-width: 576px) {
  .week-navigation {
    flex-direction: column;
    gap: 1rem;
  }
  
  .week-table th, .week-table td {
    padding: 4px 2px;
    font-size: 0.8rem;
  }
  
  .hour-cell {
    width: 40px;
  }
  
  .time-slot {
    height: 50px;
  }
  
  .task-block {
    padding: 3px;
    font-size: 0.7rem;
  }
  
  /* Mobile view options - make 1-day view active by default */
  .view-option.desktop-only.active {
    display: none;
  }
  
  .view-option:not(.desktop-only) {
    display: inline-block;
  }
  
  /* Ensure daily view is active on mobile */
  .view-option.mobile-only.active {
    background-color: var(--primary-color);
    color: white;
  }
  
  /* Make view options more touch-friendly */
  .view-option {
    min-width: 40px;
    min-height: 40px;
    padding: 0.5rem;
    font-size: 1rem;
    margin: 0.25rem;
  }
  
  .view-options {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
  }
  
  .bottom-options {
    flex-direction: row;
    justify-content: space-between;
    gap: 0.5rem;
    margin-top: 0.5rem;
  }
  
  /* Total hours display mobile optimization */
  .total-hours {
    font-size: 1rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
  }
  
  /* Mobile navigation improvements */
  .week-navigation {
    flex-direction: column;
    gap: 0.1rem; /* Minimal gap */
    padding: 0.1rem; /* Minimal padding */
    position: relative;
  }
  
  /* Create separate panes for view buttons and navigation buttons */
  .view-options {
    position: relative;
    margin-bottom: 0.5rem; /* Reduced margin */
  }
  
  /* Create a view buttons pane positioned below the main content */
  .view-options::after {
    content: '';
    display: block;
    height: 45px; /* Reduced space for view buttons */
    width: 100%;
  }
  
  /* Position view buttons to fill horizontal space evenly */
  .view-options .view-option:not(.desktop-only) {
    position: absolute;
    bottom: 0;
    font-size: 0.9rem;
    padding: 0.75rem 0.5rem; /* Restored padding */
    min-height: 45px; /* Restored height */
    z-index: 10;
    width: calc(33.33% - 7px); /* Three buttons with gaps */
  }
  
  .view-options .view-option:nth-child(1) {
    left: 0;
  }
  
  .view-options .view-option:nth-child(2) {
    left: calc(33.33% + 3px);
  }
  
  .view-options .view-option:last-child {
    right: 0;
  }
  
  /* Create a navigation buttons container positioned below view buttons */
  .week-navigation::after {
    content: '';
    display: block;
    height: 45px; /* Reduced space for navigation buttons */
    width: 100%;
  }
  
  /* Position navigation buttons to fill horizontal space evenly */
  .week-navigation > button:first-child {
    position: absolute;
    left: 0;
    bottom: 0;
    width: calc(50% - 5px); /* Take half width minus gap */
    font-size: 1rem;
    padding: 0.75rem; /* Restored padding */
    min-height: 45px; /* Restored height */
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
  }
  
  .week-navigation > button:last-child {
    position: absolute;
    right: 0;
    bottom: 0;
    width: calc(50% - 5px); /* Take half width minus gap */
    font-size: 1rem;
    padding: 0.75rem; /* Restored padding */
    min-height: 45px; /* Restored height */
    z-index: 10;
    pointer-events: auto;
    cursor: pointer;
  }
  
  /* Fix table header alignment on mobile */
  .week-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border-radius: 0;
    overflow: visible;
  }
  
  .week-table .header-row th {
    background-color: var(--primary-color);
    color: white;
    text-align: center;
    vertical-align: middle;
    padding: 8px 4px;
    font-size: 0.9rem;
    border: 1px solid var(--light-gray);
    cursor: pointer;
  }
  
  .week-table .header-row th:first-child {
    background-color: var(--secondary-color);
    cursor: default;
  }
  
  .week-table .header-row th:hover {
    background-color: var(--secondary-color);
  }
  
  .week-table th {
    text-align: center;
    vertical-align: middle;
    padding: 8px 4px;
    font-size: 0.9rem;
    border: 1px solid var(--light-gray);
    border-bottom: none;
  }
  
  .week-table td {
    vertical-align: top;
    padding: 4px 2px;
    text-align: center;
    border: 1px solid var(--light-gray);
    border-bottom: none;
  }
  
  /* Mobile table column sizing */
  .week-table th:first-child,
  .week-table td:first-child {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    text-align: center !important;
    padding: 4px 2px !important;
    font-size: 0.8rem !important;
  }
  
  .hour-cell {
    width: 80px !important;
    min-width: 80px !important;
    max-width: 80px !important;
    text-align: right !important;
    padding-right: 8px !important;
    font-size: 0.8rem !important;
  }
  
  /* Daily view specific - hide columns 3-8, show only first 2 columns */
  .week-table.daily-view .header-row th:nth-child(n+3),
  .week-table.daily-view th:nth-child(n+3),
  .week-table.daily-view td:nth-child(n+3) {
    display: none;
  }
  
  .week-table.daily-view .header-row th:first-child,
  .week-table.daily-view th:first-child,
  .week-table.daily-view td:first-child {
    width: 80px;
  }
  
  .week-table.daily-view .header-row th:nth-child(2),
  .week-table.daily-view th:nth-child(2),
  .week-table.daily-view td:nth-child(2) {
    width: calc(100% - 80px);
  }
  
  .week-navigation h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
  }
  
  /* Ensure text doesn't overflow */
  .header-title {
    font-size: 1.25rem;
    margin-left: 0.5rem;
  }
  
  /* Fix dashboard layout */
  .dashboard-container {
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
    border: none !important;
    box-shadow: none !important;
    gap: 0 !important;
  }
  
  .dashboard-section {
    max-width: 100%;
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
  }
  
  /* Fix white line on right side and remove bottom border */
  .week-table {
    width: 100% !important;
    table-layout: fixed !important;
    border: none !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
    box-shadow: none !important;
    outline: none !important;
  }
  
  .week-table th:last-child,
  .week-table td:last-child {
    border-right: none !important;
  }
  
  .week-table tr:last-child td {
    border-bottom: none !important;
  }
  
  .week-table tr:last-child th {
    border-bottom: none !important;
  }
  
  /* Remove all borders from table cells on mobile */
  .week-table th,
  .week-table td {
    border-bottom: none !important;
  }
  
  /* Remove any pseudo-elements that might create lines */
  .week-table::before,
  .week-table::after,
  .dashboard-section::before,
  .dashboard-section::after,
  .dashboard-container::before,
  .dashboard-container::after {
    display: none !important;
    content: none !important;
  }
  
  /* Smaller padding in forms */
  .form-container {
    padding: 1rem;
  }
  
  /* Smaller header */
  .header-container h1 {
    font-size: 1.5rem;
  }
  
  /* Mobile-friendly form improvements */
  .form-control {
    padding: 0.75rem;
    font-size: 16px; /* Prevents iOS zoom */
    min-height: 44px; /* Touch target size */
  }
  
  .tab-button {
    min-height: 44px; /* Touch target size */
    padding: 0.75rem;
  }
  
  .btn {
    padding: 0.75rem 1.5rem;
    min-height: 44px; /* Touch target size */
    font-size: 16px;
  }
  
  /* Stack form elements vertically */
  .form-row {
    flex-direction: column;
  }
  
  .form-row > * {
    width: 100% !important;
    margin-bottom: 1rem;
  }
  
  /* Better spacing for small screens */
  .log-time-card {
    padding: 1rem;
    margin: 0.5rem;
  }
  
  /* Timer controls mobile optimization */
  .timer-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
  }
  
  .timer-controls .btn {
    flex: 1;
    min-width: 80px;
    max-width: 120px;
  }
  
  .timer-display {
    font-size: 2rem;
    text-align: center;
    padding: 1rem;
    background: var(--light-color);
    border-radius: 8px;
    margin: 1rem 0;
    font-weight: bold;
    color: var(--primary-color);
  }
}