/* Global Variables */
:root {
  --primary-color: #00897b; /* Teal Green */
  --secondary-color: #e0f2f1; /* Light Mint/White */
  --text-color: #333;
  --bg-color: #f4f6f8;
  --sidebar-width: 250px;
  --header-height: 60px;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Inter", sans-serif;
  margin: 0;
  padding: 0;
  color: var(--text-color);
  background-color: var(--bg-color);
  display: flex;
  height: 100vh;
  overflow: hidden; /* Prevent body scroll, handle in main-content */
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: #fff;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  padding: 20px;
  position: fixed;
  height: 100%;
  z-index: 100;
  overflow-y: auto;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 40px;
  display: flex;
  align-items: center;
}

.nav-item {
  padding: 10px 15px;
  margin-bottom: 5px;
  color: #555;
  text-decoration: none;
  border-radius: 8px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-item:hover,
.nav-item.active {
  background-color: var(--secondary-color);
  color: var(--primary-color);
  font-weight: 500;
}

/* Sub-menu styling */
.nav-group {
  margin-bottom: 5px;
}

.nav-toggle {
  cursor: pointer;
  justify-content: space-between;
}

.sub-menu {
  display: none;
  padding-left: 20px;
  margin-top: 2px;
}

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

.sub-menu .nav-item {
  font-size: 0.9rem;
  padding: 8px 15px;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: calc(100% - var(--sidebar-width));
  position: relative;
  z-index: 1;
}

/* Header */
.top-header {
  height: var(--header-height);
  background-color: #fff;
  border-bottom: 1px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 32px;
  height: 32px;
  background-color: var(--primary-color);
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

/* Page Content */
.page-content {
  padding: 30px;
  overflow-y: auto;
  flex: 1; /* Allow content to grow and scroll */
}

/* Components */
.card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-block;
}

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

.btn-primary:hover {
  opacity: 0.9;
}

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

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

.search-modal {
  background: white;
  width: 600px;
  max-width: 90%;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.search-input-container {
  padding: 15px;
  border-bottom: 1px solid #eee;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-input-container svg {
  color: #888;
}

#global-search-input {
  width: 100%;
  border: none;
  font-size: 1.1rem;
  outline: none;
  padding: 5px;
}

.search-results {
  padding: 10px;
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  padding: 10px 15px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-color);
}

.search-result-item:hover,
.search-result-item.selected {
  background-color: var(--secondary-color);
}

.search-footer {
  padding: 10px 15px;
  background: #f9f9f9;
  border-top: 1px solid #eee;
  font-size: 0.8rem;
  color: #888;
  display: flex;
  justify-content: space-between;
}

/* Utilities */
.text-teal {
  color: var(--primary-color);
}
.mt-4 {
  margin-top: 1rem;
}
.ml-2 {
  margin-left: 0.5rem;
}
.flex {
  display: flex;
}
.justify-between {
  justify-content: space-between;
}
.items-center {
  align-items: center;
}
.gap-4 {
  gap: 1rem;
}
.gap-2 {
  gap: 0.5rem;
}

/* Chrono Specific Styles */
.chrono-hero {
  background: linear-gradient(135deg, #00695c 0%, #00897b 100%);
  border-radius: 16px;
  padding: 40px;
  color: white;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 137, 123, 0.2);
  margin-bottom: 30px;
}

.chrono-hero::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    rgba(255, 255, 255, 0) 70%
  );
  pointer-events: none;
}

.chrono-session-title {
  font-size: 1.2rem;
  font-weight: 300;
  margin-bottom: 5px;
  opacity: 0.9;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.chrono-timer-display {
  font-size: 8rem;
  font-weight: 700;
  margin: 10px 0;
  font-family: "Outfit", "Inter", sans-serif;
  line-height: 1;
  text-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chrono-timer-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.9rem;
  margin-bottom: 30px;
  opacity: 0.8;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
}

.status-running {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.status-paused {
  background: #ffecb3;
  color: #f57f17;
}

.chrono-controls {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.chrono-btn {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1.2rem;
}

.chrono-btn-play {
  background: white;
  color: var(--primary-color);
  width: 70px;
  height: 70px;
  font-size: 1.8rem;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chrono-btn-play:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.chrono-btn-secondary {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

.chrono-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
}

.chrono-btn-stop:hover {
  background: #ffccbc;
  color: #d84315;
}

.chrono-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 15px;
  color: #444;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.task-card {
  background: white;
  padding: 16px 20px;
  border-radius: 12px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #eee;
  transition: all 0.2s;
}

.task-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateX(4px);
  border-color: var(--secondary-color);
}

.quick-add-form {
  display: flex;
  gap: 10px;
  background: white;
  padding: 15px;
  border-radius: 12px;
  border: 1px solid #eee;
  margin-bottom: 25px;
}

.quick-add-input {
  flex: 1;
  border: none;
  padding: 10px;
  font-size: 1rem;
  outline: none;
}

/* =========================================
   Mobile Responsive Styles
   ========================================= */

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none; /* Hidden on desktop */
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-color);
  cursor: pointer;
  padding: 5px;
  margin-right: 15px;
}

/* Sidebar Overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
  opacity: 0;
  transition: opacity 0.3s;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* Responsive Breakpoints */

/* Tablet & Mobile (Below 1024px) */
@media (max-width: 1024px) {
  /* Layout Changes */
  body {
    position: relative;
  }

  .sidebar {
    transform: translateX(-100%); /* Hide sidebar off-screen */
    transition: transform 0.3s ease-in-out;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  }

  .sidebar.open {
    transform: translateX(0); /* Slide in */
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  /* Header */
  .mobile-menu-toggle {
    display: block;
  }
}

/* Mobile (Below 768px) */
@media (max-width: 768px) {
  :root {
    --header-height: 50px;
  }

  .top-header {
    padding: 0 15px;
  }

  .page-content {
    padding: 15px;
  }

  /* Typography */
  h1 {
    font-size: 1.5rem;
  }
  h2 {
    font-size: 1.25rem;
  }
  h3 {
    font-size: 1.1rem;
  }

  /* Hide Search Text Shortcut */
  .search-bar span {
    display: none;
  }

  .header-actions {
    gap: 10px;
  }

  /* Chrono Timer Scaling */
  .chrono-hero {
    padding: 20px;
  }

  .chrono-timer-display {
    font-size: 4rem; /* Smaller timer */
  }

  .chrono-controls {
    gap: 10px;
  }

  .chrono-btn-play {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }

  /* Cards & Spacing */
  .card {
    padding: 15px;
    margin-bottom: 15px;
  }

  /* Tables - Scrollable Wrapper */
  table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
  }

  /* Quick Add Form */
  .quick-add-form {
    flex-direction: column;
  }

  /* Flex Utils */
  .flex {
    flex-wrap: wrap;
  }
}

/* Small Mobile (Below 480px) */
@media (max-width: 480px) {
  .chrono-timer-display {
    font-size: 3.5rem;
  }

  .user-profile span {
    display: none; /* Hide user name on very small screens */
  }

  .user-profile .avatar {
    margin-right: 0;
  }
}

/* =========================================
   Finance Journal Specific Styles
   ========================================= */
.journal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.journal-filter-form {
  display: flex;
  gap: 10px;
}

@media (max-width: 768px) {
  .journal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .journal-filter-form {
    flex-direction: column;
    width: 100%;
  }
  
  /* Make date inputs full width on mobile */
  .journal-filter-form .form-control {
    width: 100%;
    flex: 1;
  }
  
  .journal-filter-form button {
    width: 100%;
  }
  
  .journal-header > div {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  
  /* Add button full width */
  .journal-header .btn {
    width: 100%;
    justify-content: center;
  }
}
