/* ============================================
   VESSO - Notebook Theme Stylesheet
   ============================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

/* Notebook-style background with paper texture */
body {
  font-family: "Georgia", "Times New Roman", serif;
  background: linear-gradient(135deg, #f4e8d8 0%, #e8dcc8 100%);
  color: #3d3020;
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 31px,
    rgba(139, 69, 19, 0.08) 31px,
    rgba(139, 69, 19, 0.08) 32px
  );
  pointer-events: none;
  z-index: 0;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.4;
  color: #2d1f0f;
  font-family: "Georgia", "Times New Roman", serif;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

h4 {
  font-size: 1.125rem;
  font-weight: 600;
}

h5 {
  font-size: 1rem;
  font-weight: 500;
}

p {
  color: #5d4a35;
  line-height: 1.75;
}

/* Notebook-style buttons with handwritten feel */
.button {
  padding: 0.75rem 1.75rem;
  border: 2px solid #8b5a3c;
  border-radius: 4px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  background-color: #f9f3ea;
  color: #5d4a35;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 2px 2px 0 rgba(139, 90, 60, 0.3);
  font-family: "Georgia", serif;
  position: relative;
}

.button:hover {
  background-color: #f5ebe0;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 rgba(139, 90, 60, 0.3);
}

.button:active {
  transform: translate(2px, 2px);
  box-shadow: none;
}

.button-primary {
  background: #dc7860;
  color: #fff;
  border-color: #b85f4a;
  box-shadow: 3px 3px 0 rgba(139, 69, 19, 0.3);
}

.button-primary:hover {
  background: #c86a54;
  box-shadow: 2px 2px 0 rgba(139, 69, 19, 0.3);
}

.button-secondary {
  background: #8b7355;
  color: #fff;
  border-color: #6d5a43;
  box-shadow: 3px 3px 0 rgba(69, 50, 30, 0.3);
}

.button-secondary:hover {
  background: #7a6449;
  box-shadow: 2px 2px 0 rgba(69, 50, 30, 0.3);
}

.button-danger {
  background: #c84545;
  color: #fff;
  border-color: #a03636;
  box-shadow: 3px 3px 0 rgba(139, 20, 20, 0.3);
}

.button-danger:hover {
  background: #b33d3d;
  box-shadow: 2px 2px 0 rgba(139, 20, 20, 0.3);
}

/* Notebook-style form inputs */
input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 0.875rem 1rem;
  margin: 0.5rem 0 1rem 0;
  border: none;
  border-bottom: 2px solid #8b5a3c;
  background: transparent;
  font-size: 0.9375rem;
  font-family: "Georgia", serif;
  transition: all 0.2s ease;
  color: #2d1f0f;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
  outline: none;
  border-bottom-color: #dc7860;
  background: rgba(249, 243, 234, 0.5);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder {
  color: #a08970;
  font-style: italic;
}

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

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #2d1f0f;
  font-size: 0.9375rem;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 2rem;
}

/* Checkboxes */
input[type="checkbox"] {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: #dc7860;
  border-radius: 3px;
}

.complete-section {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.complete-section:hover {
  background-color: rgba(249, 243, 234, 0.5);
}

.complete-section label {
  cursor: pointer;
  font-weight: 500;
  color: #5d4a35;
  user-select: none;
}

/* Two-column layout: sidebar + main content area */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

/* Left sidebar for task list */
.tasks-sidebar {
  width: 320px;
  background: rgba(249, 243, 234, 0.95);
  /* Put red line behind content with z-index */
  border-right: 3px solid rgba(220, 120, 96, 0.4);
  padding: 1.5rem;
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 5;
  box-shadow: 4px 0 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 2px dashed #d4b896;
  flex-shrink: 0;
}

.sidebar-header .button {
  width: 100%;
  font-size: 1rem;
  padding: 1rem;
}

/* Task list in sidebar - compact folded view */
.task-list-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden; /* Prevent horizontal scrolling */
  margin-bottom: 1.5rem;
}

.sidebar-task-item {
  background: #fefaf5;
  border-radius: 4px;
  padding: 1rem;
  border: 2px solid #d4b896;
  border-left: 4px solid #dc7860;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.08);
  /* Prevent overflow in sidebar items */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.sidebar-task-item:hover {
  transform: translateX(4px);
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.12);
  border-left-color: #c86a54;
}

.sidebar-task-item.active {
  background: #fff9f0;
  border-left-width: 6px;
  border-left-color: #dc7860;
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-task-title {
  font-size: 1rem;
  font-weight: 600;
  color: #2d1f0f;
  margin-bottom: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Ensure title doesn't overflow */
  max-width: 100%;
}

.sidebar-task-preview {
  font-size: 0.8125rem;
  color: #8b7355;
  margin-bottom: 0.5rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-style: italic;
  /* Ensure preview doesn't overflow */
  max-width: 100%;
}

.sidebar-task-time {
  font-size: 0.75rem;
  color: #a08970;
  font-weight: 500;
}

/* Right main content area for expanded task view */
.task-detail-area {
  flex: 1;
  margin-left: 320px;
  padding: 2rem 3rem;
  overflow-y: auto;
  position: relative;
}

/* Empty state when no task is selected */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: 3rem;
}

.empty-state h2 {
  color: #5d4a35;
  font-size: 1.75rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.empty-state p {
  color: #8b7355;
  font-size: 1.125rem;
  font-style: italic;
  max-width: 500px;
}

/* Expanded task view styling */
.expanded-task-view {
  display: none;
  animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.expanded-task-view .task-card {
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  cursor: default;
  background: transparent;
}

.expanded-task-view .task-title {
  font-size: 3rem;
  font-weight: 700;
  color: #2d1f0f;
  margin-bottom: 1.5rem;
  line-height: 1.2;
}

.expanded-task-view .task-description {
  font-size: 1.5rem;
  color: #5d4a35;
  margin-bottom: 2rem;
  line-height: 1.8;
  font-style: italic;
}

.expanded-task-view .task-time {
  font-size: 0.9375rem;
  color: #8b7355;
  margin-bottom: 2.5rem;
  font-weight: 500;
}

.expanded-task-view .task-actions {
  display: flex;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px dashed #d4b896;
}

.expanded-task-view .complete-section {
  padding: 1rem;
  background: rgba(249, 243, 234, 0.5);
  border-radius: 4px;
}

.expanded-task-view .complete-section label {
  font-size: 1.125rem;
}

/* Notebook header with vintage styling */
.header {
  background: linear-gradient(135deg, #dc7860 0%, #c86a54 100%);
  color: #fff;
  padding: 4rem 2rem;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid #8b5a3c;
}

.header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 10px,
    rgba(255, 255, 255, 0.03) 10px,
    rgba(255, 255, 0.03) 20px
  );
  opacity: 0.5;
}

.header-title {
  color: white;
  font-size: 2.75rem;
  font-weight: 700;
  position: relative;
  z-index: 1;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  font-family: "Georgia", serif;
}

/* Notebook paper cards */
.description-card {
  max-width: 700px;
  margin: 2.5rem auto;
  padding: 2.5rem;
  background: #fefaf5;
  border-radius: 4px;
  box-shadow: 4px 4px 12px rgba(0, 0, 0, 0.15);
  border: 2px solid #d4b896;
  position: relative;
  z-index: 2;
}

.description-text {
  font-size: 1.125rem;
  line-height: 1.8;
  color: #5d4a35;
  text-align: center;
}

/* Notebook-style task cards */
.task-card {
  background: #fefaf5;
  border-radius: 4px;
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: 3px 3px 8px rgba(0, 0, 0, 0.12);
  border: 2px solid #d4b896;
  border-left: 4px solid #dc7860;
  transition: all 0.3s ease;
  position: relative;
  z-index: 2;
}

.task-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.task-title {
  color: #2d1f0f;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  font-family: "Georgia", serif;
}

.task-content {
  margin-top: 1rem;
}

.task-description {
  color: #5d4a35;
  margin-bottom: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.7;
  font-style: italic;
}

.task-time {
  color: #8b7355;
  font-size: 0.8125rem;
  margin-bottom: 1rem;
  font-weight: 500;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px dashed #d4b896;
}

/* Notebook-style auth pages */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1rem;
  position: relative;
  z-index: 2;
}

.auth-form {
  background: #fefaf5;
  border-radius: 4px;
  padding: 3rem;
  width: 100%;
  max-width: 440px;
  box-shadow: 6px 6px 16px rgba(0, 0, 0, 0.2);
  border: 2px solid #d4b896;
  position: relative;
}

.auth-heading {
  text-align: center;
  margin-bottom: 2rem;
  color: #2d1f0f;
  font-size: 1.75rem;
  font-weight: 700;
  font-family: "Georgia", serif;
}

/* Get Started Page */
.getstarted-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.button-container {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 500px;
  margin: 2rem auto;
  padding: 0 1rem;
  position: relative;
  z-index: 2;
}

.button-container .button {
  flex: 1;
  min-width: 180px;
  padding: 1rem 2rem;
  font-size: 1rem;
}

/* Notebook-style profile button */
.profile-button {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.25rem;
  background: #fefaf5;
  border: 2px solid #8b5a3c;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
  color: #2d1f0f;
  box-shadow: 3px 3px 6px rgba(0, 0, 0, 0.15);
  font-family: "Georgia", serif;
}

.profile-button:hover {
  background: #f9f3ea;
  transform: translate(1px, 1px);
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.15);
}

#user_image {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #8b5a3c;
}

.user-card {
  background: #fefaf5;
  border-radius: 4px;
  padding: 1.75rem;
  box-shadow: 6px 6px 16px rgba(0, 0, 0, 0.2);
  min-width: 240px;
  display: none;
  position: absolute;
  top: 70px;
  right: 20px;
  z-index: 1000;
  border: 2px solid #8b5a3c;
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 2px dashed #d4b896;
}

.auth-error {
  color: #c84545;
  background: #fef2f2;
  border: 2px solid #f5c2c2;
  padding: 0.875rem 1rem;
  border-radius: 4px;
  margin: 0.5rem 0 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
}

.user-info img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #8b5a3c;
}

.profile-action-button {
  width: 100%;
  margin-bottom: 0.5rem;
  background: #f9f3ea;
  border: 2px solid #8b5a3c;
  padding: 0.875rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s ease;
  color: #5d4a35;
  font-size: 0.9375rem;
  box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  font-family: "Georgia", serif;
}

.profile-action-button:hover {
  background: #dc7860;
  color: white;
  border-color: #b85f4a;
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
}

#profile_visit {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

/* Task form modal styling */
.task-form-modal {
  background: #fefaf5;
  border-radius: 4px;
  padding: 2.5rem;
  display: none;
  border: 3px solid #8b5a3c;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  max-width: 500px;
  width: calc(100% - 2rem);
  box-shadow: 8px 8px 24px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

/* Modal backdrop */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(61, 48, 32, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: none;
}

.modal-backdrop.active {
  display: block;
  animation: fadeInBackdrop 0.2s ease;
}

@keyframes fadeInBackdrop {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Modal */
.modal {
  background: #fefaf5;
  border-radius: 4px;
  padding: 2.5rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  box-shadow: 8px 8px 24px rgba(0, 0, 0, 0.3);
  display: none;
  text-align: center;
  border: 3px solid #8b5a3c;
  /* Position modal centered on screen */
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 9999;
  animation: modalSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -48%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.modal.active {
  display: block;
}

.modal h3 {
  margin-bottom: 2rem;
  color: #2d1f0f;
  font-size: 1.25rem;
  line-height: 1.5;
  font-family: "Georgia", serif;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.5rem;
}

/* Utility Classes */
.page-title {
  text-align: center;
  margin: 3rem 0 2rem;
  color: #2d1f0f;
  font-size: 2.5rem;
  font-weight: 700;
  font-family: "Georgia", serif;
  position: relative;
  z-index: 2;
}

.recycle-button-container {
  margin-top: auto;
  padding-top: 1.5rem;
  border-top: 2px dashed #d4b896;
  flex-shrink: 0;
  /* Keep bin button fixed at bottom */
  position: sticky;
  bottom: 0;
  background: rgba(249, 243, 234, 0.95);
}

.recycle-button-container .button {
  width: 100%;
}

/* Add completed task styling - dimmed color and moved to bottom */
.sidebar-task-item.completed {
  background: #f5f0e8;
  border-left-color: #a08970;
  opacity: 0.7;
  order: 999; /* Move to bottom */
}

.sidebar-task-item.completed .sidebar-task-title {
  color: #8b7355;
  text-decoration: line-through;
}

.sidebar-task-item.completed .sidebar-task-preview {
  color: #a08970;
}

.task-card.completed {
  background: #f5f0e8;
  border-left-color: #a08970;
  opacity: 0.75;
}

.task-card.completed .task-title {
  color: #8b7355;
  text-decoration: line-through;
}

.task-card.completed .task-description {
  color: #a08970;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .tasks-sidebar {
    width: 280px;
  }

  .task-detail-area {
    margin-left: 280px;
    padding: 2rem;
  }

  .expanded-task-view .task-title {
    font-size: 2.5rem;
  }

  .expanded-task-view .task-description {
    font-size: 1.25rem;
  }
}

/* Improved mobile responsive layout */
@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .tasks-sidebar {
    position: relative;
    width: 100%;
    height: auto;
    max-height: 50vh;
    border-right: none;
    border-bottom: 3px solid rgba(220, 120, 96, 0.4);
    padding: 1rem;
  }

  .sidebar-header {
    margin-bottom: 1rem;
  }

  .sidebar-header .button {
    font-size: 0.9rem;
    padding: 0.75rem;
  }

  .task-list-sidebar {
    max-height: calc(50vh - 150px);
    overflow-y: auto;
  }

  .sidebar-task-item {
    padding: 0.75rem;
  }

  .sidebar-task-title {
    font-size: 0.9rem;
  }

  .sidebar-task-preview {
    font-size: 0.75rem;
  }

  .sidebar-task-time {
    font-size: 0.7rem;
  }

  .task-detail-area {
    margin-left: 0;
    padding: 1.5rem 1rem;
  }

  .empty-state {
    min-height: 40vh;
    padding: 2rem 1rem;
  }

  .empty-state h2 {
    font-size: 1.5rem;
  }

  .empty-state p {
    font-size: 1rem;
  }

  .expanded-task-view .task-title {
    font-size: 2rem;
  }

  .expanded-task-view .task-description {
    font-size: 1.125rem;
  }

  .expanded-task-view .task-actions {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .expanded-task-view .task-actions .button {
    padding: 0.625rem 1rem;
  }
}
