/* Color Palette */
:root {
  --purple-1: #9055fa;
  --purple-2: #5a55fa;
  --pink-1: #fa55f7;
  --pink-2: #fa5594;
  --primary: #c656fa;
  --bg-light: #fafafa;
  --bg-white: #ffffff;
  --text-dark: #2d2d2d;
  --text-gray: #6b6b6b;
  --border-light: #e5e5e5;
}

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-light);
  color: var(--text-dark);
  line-height: 1.6;
}

/* Navigation */
.navbar {
  background: linear-gradient(
    135deg,
    var(--purple-1) 0%,
    var(--primary) 50%,
    var(--pink-1) 100%
  );
  padding: 1rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

.nav-brand {
  color: white;
  font-size: 1.5rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  gap: 2rem;
}

/* Burger Menu Button */
.burger-menu {
  display: none;
  flex-direction: column;
  justify-content: space-around;
  width: 28px;
  height: 24px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
  position: relative;
  outline: none;
}

.burger-menu:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.burger-menu span {
  width: 100%;
  height: 3px;
  background-color: white;
  border-radius: 3px;
  transition: all 0.3s ease;
  transform-origin: center;
}

.burger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.burger-menu.active span:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}

.burger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.15);
}

.nav-link.active {
  background-color: rgba(255, 255, 255, 0.25);
}

/* Main Container */
.container {
  max-width: 1400px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
}

/* Timer Section */
.timer-section {
  background: var(--bg-white);
  padding: 3rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
  margin-bottom: 2rem;
  text-align: center;
}

.timer-display {
  font-size: 5rem;
  font-weight: 300;
  color: var(--primary);
  margin-bottom: 2rem;
  letter-spacing: 2px;
}

.timer-display .seconds {
  font-size: 3.5rem;
  font-weight: 200;
  opacity: 0.7;
}

.timer-button {
  background: linear-gradient(135deg, var(--purple-1), var(--primary));
  color: white;
  border: none;
  padding: 1.2rem 3rem;
  font-size: 1.2rem;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(197, 86, 250, 0.3);
}

.timer-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(197, 86, 250, 0.4);
}

.timer-button:active {
  transform: translateY(0);
}

.timer-button.running {
  background: linear-gradient(135deg, var(--pink-2), var(--pink-1));
}

/* Time Sheet Section */
.sheet-section {
  background: var(--bg-white);
  padding: 1rem;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.sheet-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.sheet-header {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-dark);
  margin: 0;
}

/* Tabs */
.tabs-container {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border-light);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.tabs-container::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.tab {
  background: none;
  border: none;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-gray);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
  white-space: nowrap;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.tab:hover {
  color: var(--primary);
  background-color: rgba(197, 86, 250, 0.05);
}

.tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.tab.tab-today {
  background: linear-gradient(
    135deg,
    rgba(197, 86, 250, 0.1),
    rgba(144, 85, 250, 0.1)
  );
  border-radius: 8px 8px 0 0;
  font-weight: 700;
}

.tab.tab-today.active {
  background: linear-gradient(
    135deg,
    rgba(197, 86, 250, 0.15),
    rgba(144, 85, 250, 0.15)
  );
}

.sheet-subheader {
  color: var(--text-gray);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

.btn-add-entry {
  background: linear-gradient(135deg, var(--purple-1), var(--primary));
  color: white;
  border: none;
  padding: 0.7rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 2px 10px rgba(197, 86, 250, 0.3);
}

.btn-add-entry:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(197, 86, 250, 0.4);
}

.btn-add-entry:active {
  transform: translateY(0);
}

.time-sheet {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.time-sheet thead th {
  text-align: left;
  padding: 1rem;
  font-weight: 600;
  color: var(--text-gray);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-light);
}

/* Desktop column widths - make time columns narrower */
.time-sheet thead th:nth-child(1),
.time-sheet thead th:nth-child(2),
.time-sheet thead th:nth-child(3) {
  width: 10%;
  min-width: 100px;
}

.time-sheet tbody td.time-col,
.time-sheet tbody td.duration-col {
  width: 10%;
  min-width: 90px;
}

.time-sheet tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background-color 0.15s;
}

.time-sheet tbody tr:hover {
  background-color: rgba(197, 86, 250, 0.03);
}

.time-sheet tbody td {
  padding: 1rem;
}

.date-col {
  font-size: 0.9rem;
  color: var(--text-gray);
  font-weight: 500;
  white-space: nowrap;
}

.time-col {
  font-family: "Courier New", monospace;
  font-size: 1rem;
  color: var(--text-dark);
  white-space: nowrap;
}

.time-col .seconds {
  font-size: 0.85rem;
  font-weight: 300;
  opacity: 0.6;
}

.duration-col {
  font-family: "Courier New", monospace;
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 600;
  white-space: nowrap;
}

.activity-col {
  color: var(--text-dark);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.category-col {
  color: var(--primary);
  font-weight: 500;
  min-width: 120px;
  white-space: nowrap;
}

.actions-col {
  white-space: nowrap;
  width: 180px;
  min-width: 180px;
}

.btn-edit {
  background: var(--border-light);
  color: var(--text-dark);
  border: none;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  margin-right: 0.5rem;
}

.btn-edit .btn-edit-icon {
  display: none;
}

.btn-edit .btn-edit-text {
  display: inline;
}

.btn-edit:hover {
  background: #d5d5d5;
  transform: translateY(-1px);
}

.btn-edit:active {
  transform: translateY(0);
}

.btn-add-after {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 0.2s, background-color 0.2s;
  color: var(--primary);
  vertical-align: middle;
}

.btn-add-after:hover {
  background: rgba(197, 86, 250, 0.1);
  transform: scale(1.1);
}

.btn-add-after:active {
  transform: scale(0.95);
}

.btn-add-after svg {
  display: block;
}

.btn-edit-dream {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: transform 0.2s, background-color 0.2s;
  color: var(--text-gray);
}

.btn-edit-dream:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--primary);
  transform: scale(1.1);
}

.btn-edit-dream:active {
  transform: scale(0.95);
}

.btn-edit-dream svg {
  display: block;
}

.dream-date-col {
  font-size: 0.85rem;
  font-weight: 300;
  opacity: 0.6;
  font-family: "Courier New", monospace;
  color: var(--text-gray);
  position: relative;
  top: 2px;
}

.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-gray);
}

.empty-state p {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: var(--bg-white);
  padding: 2.5rem;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
}

.modal-header {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-dark);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.form-row .form-group {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-gray);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.8rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.form-group input[readonly] {
  background-color: var(--bg-light);
  cursor: not-allowed;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
}

.modal-buttons {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

.btn-icon {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-1), var(--primary));
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(197, 86, 250, 0.3);
}

.btn-secondary {
  background: var(--border-light);
  color: var(--text-gray);
}

.btn-secondary:hover {
  background: #d5d5d5;
}

.btn-danger {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 1.5rem;
  }

  .burger-menu {
    display: flex !important;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(
      135deg,
      var(--purple-1) 0%,
      var(--primary) 50%,
      var(--pink-1) 100%
    );
    flex-direction: column;
    gap: 0;
    padding: 1rem 0;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
    max-height: 0;
    overflow: hidden;
    display: none;
  }

  .nav-links.active {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    max-height: 300px;
  }

  .nav-link {
    display: block;
    padding: 1rem 2rem;
    width: 100%;
    border-radius: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-link:last-child {
    border-bottom: none;
  }

  .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
  }

  .nav-link.active {
    background-color: rgba(255, 255, 255, 0.3);
  }

  .timer-display {
    font-size: 3.5rem;
  }

  .timer-display .seconds {
    font-size: 2.5rem;
  }

  .sheet-header-row {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }

  .btn-add-entry {
    width: 100%;
  }

  /* Mobile Card Layout for Time Entries */
  .time-sheet {
    display: block;
    font-size: 0.9rem;
  }

  .time-sheet thead {
    display: none;
  }

  .time-sheet tbody {
    display: block;
  }

  .time-sheet tbody tr {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    background: var(--bg-white);
    border: none;
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    align-items: flex-start;
  }

  .time-sheet tbody tr:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    background-color: var(--bg-white);
  }

  .time-sheet tbody td {
    display: block;
    padding: 0;
    border: none;
    text-align: left;
  }

  /* Hide empty state colspan on mobile */
  .time-sheet tbody tr td[colspan] {
    display: block;
  }

  /* Date on its own line */
  .time-sheet tbody td.date-col {
    order: 0;
    flex-basis: 100%;
    width: 100%;
    /* margin-bottom: 0.5rem; */
  }

  /* Time Info Line - Second line with start, end, and duration */
  /* Parent is now flex row with wrap, so these will flow horizontally */
  /* Override desktop min-width to allow elements to fit on one line */
  .time-sheet tbody td.time-col,
  .time-sheet tbody td.duration-col {
    order: 1;
    flex-shrink: 0;
    flex-grow: 0;
    flex-basis: auto;
    display: inline-block !important;
    width: auto !important;
    min-width: 0 !important;
    vertical-align: baseline;
    white-space: nowrap;
  }

  .time-sheet tbody td.time-col {
    font-size: 0.75rem;
    color: var(--text-gray);
    font-family: "Courier New", monospace;
    margin-bottom: 0;
    margin-right: 0.25rem;
  }

  .time-sheet tbody td.time-col:first-of-type::after {
    content: " → ";
    margin: 0 0.2rem;
    color: var(--text-gray);
    opacity: 0.5;
  }

  .time-sheet tbody td.time-col:last-of-type {
    margin-right: 0.5rem;
  }

  /* Duration on same line as times */
  .time-sheet tbody td.duration-col {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 600;
    font-family: "Courier New", monospace;
    /* margin-bottom: 0.75rem; */
    margin-left: 0;
  }

  .time-sheet tbody td.duration-col::before {
    content: "(";
    margin-right: 0.1rem;
  }

  .time-sheet tbody td.duration-col::after {
    content: ")";
    margin-left: 0.1rem;
  }

  /* Force activity to wrap to new line */
  .time-sheet tbody td.activity-col {
    flex-basis: 100%;
    width: 100%;
  }

  /* Activity - Max 2 lines with ellipsis */
  .time-sheet tbody td.activity-col {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    line-height: 1.4;
    order: 2;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: break-word;
  }

  /* Category Tag - After activity */
  .time-sheet tbody td.category-col {
    order: 3;
    margin-bottom: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: rgba(197, 86, 250, 0.1);
    color: var(--primary);
    padding: 0.3rem 0.65rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    width: fit-content;
    border: 1px solid rgba(197, 86, 250, 0.2);
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Actions Row - Now on same line as category */
  .time-sheet tbody td.actions-col {
    display: inline-flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0;
    margin-left: auto;
    /* margin-bottom: 0.75rem; */
    padding-top: 0;
    border-top: none;
    order: 3;
    flex-basis: auto;
    width: auto;
    min-width: 100px;
    flex-shrink: 0;
    text-align: right;
  }

  .time-sheet tbody td.actions-col .btn-edit {
    flex: none;
    margin-right: 0;
    padding: 0.3rem;
    font-size: 0.9rem;
    background: none;
    border: none;
    color: var(--text-gray);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: transform 0.2s, background-color 0.2s;
    cursor: pointer;
    width: 36px;
    height: 36px;
  }

  .time-sheet tbody td.actions-col .btn-edit:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--primary);
    transform: scale(1.1);
  }

  .time-sheet tbody td.actions-col .btn-edit:active {
    transform: scale(0.95);
  }

  .time-sheet tbody td.actions-col .btn-edit .btn-edit-icon {
    display: block;
  }

  .time-sheet tbody td.actions-col .btn-edit .btn-edit-text {
    display: none;
  }

  .time-sheet tbody td.actions-col .btn-edit svg {
    display: block;
    width: 18px;
    height: 18px;
  }

  .time-sheet tbody td.actions-col .btn-add-after {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(197, 86, 250, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
  }

  .time-sheet tbody td.actions-col .btn-add-after:hover {
    background: rgba(197, 86, 250, 0.2);
    transform: scale(1.05);
  }

  .time-sheet tbody td.actions-col .btn-add-after:active {
    transform: scale(0.95);
  }

  .time-sheet tbody td.actions-col .btn-add-after svg {
    width: 18px;
    height: 18px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  /* Keep category and emotion dropdowns side-by-side on mobile */
  .form-row-category-emotion {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.75rem;
  }

  /* Tabs on mobile */
  .tabs-container {
    gap: 0.25rem;
    margin-bottom: 1rem;
  }

  .tab {
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    min-height: 44px;
  }

  /* Modal buttons - show icons only on mobile */
  .modal-buttons {
    gap: 0.75rem;
  }

  .btn {
    min-width: 44px;
    padding: 0.8rem;
  }

  .btn .btn-text {
    display: none;
  }

  .btn .btn-icon {
    display: block;
  }

  /* Reduce modal padding on mobile */
  .modal-content {
    padding: 1.5rem;
  }
}
