body { font-family: system-ui, sans-serif; margin: 1.2rem; }
h1 { font-size: 1.2rem; }
form { margin: 1rem 0; }

/* Navigation Cards for Index Page */
.nav-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.nav-card {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: .5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  transition: all 0.2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
  border-left: 4px solid transparent;
}

.nav-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  text-decoration: none;
  color: inherit;
}

.nav-card.bookmarks {
  border-left-color: #2196F3;
}

.nav-card.bookmarks:hover {
  border-left-color: #1976D2;
}

.nav-card.todos {
  border-left-color: #4CAF50;
}

.nav-card.todos:hover {
  border-left-color: #388E3C;
}

.nav-card.reminders {
  border-left-color: #9c27b0;
}

.nav-card.reminders:hover {
  border-left-color: #7b1fa2;
}

.nav-card.gemini {
  border-left-color: #673ab7;
}

.nav-card.gemini:hover {
  border-left-color: #512da8;
}

.nav-card.api {
  border-left-color: #ff9800;
}

.nav-card.api:hover {
  border-left-color: #F57C00;
}

.nav-card-title {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: .5rem;
  color: #333;
}

.nav-card-description {
  font-size: .9rem;
  color: #666;
  line-height: 1.4;
}

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

.form-group label {
  display: block;
  margin-bottom: .3rem;
  font-weight: bold;
  font-size: .9rem;
  color: #333;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 200px;
}

#todo-form input, #todo-form select, #todo-form textarea,
#bookmark-form input, #bookmark-form select, #bookmark-form textarea,
#reminder-form input, #reminder-form select, #reminder-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: .3rem;
  font-family: inherit;
}

#todo-form textarea,
#bookmark-form textarea,
#reminder-form textarea {
  resize: vertical;
  min-height: 60px;
}

#todo-form button[type="submit"],
#bookmark-form button[type="submit"],
#reminder-form button[type="submit"] {
  background: #007bff;
  color: white;
  border: none;
  padding: .6rem 1.2rem;
  border-radius: .3rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: bold;
}

#todo-form button[type="submit"]:hover,
#bookmark-form button[type="submit"]:hover,
#reminder-form button[type="submit"]:hover {
  background: #0056b3;
}
input, button, select { padding: .4rem .6rem; font-size: .9rem; }
ul { padding-left: 1rem; }
li { margin: .3rem 0; }
.msg { margin:.5rem 0; font-size:.8rem; color:#555; }

.todo-controls { 
  margin: 1rem 0; 
  display: flex; 
  gap: 1rem; 
  flex-wrap: wrap; 
  align-items: center; 
  padding: .5rem; 
  background: #f5f5f5; 
  border-radius: .3rem; 
}

.todo-controls label { 
  font-size: .9rem; 
  display: flex; 
  align-items: center; 
  gap: .3rem; 
}

.category-group { 
  margin: 1rem 0; 
  border: 1px solid #ddd; 
  border-radius: .3rem; 
  padding: .5rem; 
}

.category-header { 
  font-weight: bold; 
  margin-bottom: .5rem; 
  color: #333; 
  border-bottom: 1px solid #eee; 
  padding-bottom: .3rem; 
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-header:hover {
  background-color: #f5f5f5;
  border-radius: .2rem;
  margin: -.2rem;
  padding: .5rem .2rem .5rem .2rem;
}

.category-toggle {
  font-size: .8rem;
  transition: transform 0.2s ease;
  transform: rotate(-90deg); /* Point right when collapsed */
}

.category-items {
  margin-top: .5rem;
}

.category-group.collapsed .category-items {
  display: none;
}

.category-group:not(.collapsed) .category-toggle {
  transform: rotate(0deg); /* Point down when expanded */
}

.todo-item { 
  padding: .3rem .5rem; /* Reduced vertical padding from .5rem to .3rem */
  margin: .2rem 0; /* Reduced margin from .3rem to .2rem */
  border-left: 3px solid #ddd; 
  background: #fff; 
  border-radius: .2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.todo-content {
  flex: 1;
  cursor: pointer;
  user-select: none;
}

.todo-actions {
  display: flex;
  gap: .3rem;
  margin-left: .5rem;
}

.edit-btn, .delete-btn {
  padding: .2rem .4rem;
  font-size: .8rem;
  border: none;
  border-radius: .2rem;
  cursor: pointer;
  font-weight: bold;
}

.edit-btn {
  background: #ffc107;
  color: #212529;
}

.edit-btn:hover {
  background: #e0a800;
}

.delete-btn {
  background: #dc3545;
  color: white;
}

.delete-btn:hover {
  background: #c82333;
}

#cancel-btn {
  background: #6c757d;
  color: white;
  border: none;
  padding: .6rem 1.2rem;
  border-radius: .3rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: bold;
  margin-left: .5rem;
}

#cancel-btn:hover {
  background: #5a6268;
}

.todo-item.completed { 
  text-decoration: line-through; 
  color: #888; 
  border-left-color: #4CAF50; 
}

.todo-item.high-priority { border-left-color: #f44336; }
.todo-item.medium-priority { border-left-color: #ff9800; }
.todo-item.low-priority { border-left-color: #4CAF50; }

.bookmark-item {
  padding: .5rem;
  margin: .3rem 0;
  border-left: 3px solid #2196F3;
  background: #fff;
  border-radius: .2rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.bookmark-title {
  font-weight: bold;
  margin-bottom: .2rem;
}

.bookmark-title a {
  color: #1976D2;
  text-decoration: none;
}

.bookmark-title a:hover {
  text-decoration: underline;
}

.bookmark-meta {
  font-size: .8rem;
  color: #666;
}

.bookmark-content {
  flex: 1;
}

.bookmark-favicon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  margin-top: 2px;
  flex-shrink: 0;
  border-radius: 2px;
}

.todo-title { font-weight: bold; }
.todo-meta { 
  font-size: .8rem; 
  color: #666; 
  margin-top: .2rem; 
}

.todo-due-date { 
  color: #d32f2f; 
  font-weight: bold; 
}

.todo-due-date.overdue { 
  color: #c62828; 
  background: #ffebee; 
  padding: 0 .3rem; 
  border-radius: .2rem; 
}

/* Reminder Styles */
.reminder-item {
  padding: .5rem;
  margin: .3rem 0;
  border-left: 3px solid #9c27b0;
  background: #fff;
  border-radius: .2rem;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: box-shadow 0.2s ease;
}

.reminder-item:hover {
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.reminder-item.completed {
  border-left-color: #4CAF50;
  background: #f8f9fa;
}

.reminder-item.pending {
  border-left-color: #ff9800;
}

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

.reminder-status {
  font-size: 1.1rem;
  margin-right: .5rem;
}

.reminder-title {
  font-weight: bold;
  flex: 1;
  margin: 0 .5rem;
  font-size: 1rem;
  color: #333;
}

.reminder-method {
  font-size: 1rem;
  margin-right: .5rem;
}

.reminder-actions {
  display: flex;
  gap: .3rem;
}

.reminder-details {
  margin-left: 1.6rem;
}

.reminder-datetime {
  font-size: .85rem;
  color: #555;
  margin: .2rem 0;
  font-weight: 500;
}

.reminder-message {
  font-size: .9rem;
  color: #666;
  margin: .3rem 0;
  line-height: 1.4;
}

.reminder-category {
  font-size: .8rem;
  color: #7b1fa2;
  margin: .2rem 0;
  font-weight: 500;
}

.reminder-tags {
  font-size: .8rem;
  color: #558b2f;
  margin: .2rem 0;
}

.reminder-repeat {
  font-size: .8rem;
  color: #1976d2;
  margin: .2rem 0;
  font-weight: 500;
}

.reminder-status-text {
  font-size: .75rem;
  color: #888;
  margin: .2rem 0;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Repeat Settings Styles */
#repeat-settings {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: .3rem;
  padding: 1rem;
  margin-top: .5rem;
}

#repeat-settings .form-row {
  margin-bottom: .5rem;
}

#repeat-settings .form-group:last-child {
  margin-bottom: 0;
}

/* Reminder Controls (reuse todo-controls but with reminder context) */
.todo-controls {
  margin: 1rem 0;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  padding: .5rem;
  background: #f5f5f5;
  border-radius: .3rem;
}

/* Gemini-specific styling */
#gemini-form input, #gemini-form select, #gemini-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #ddd;
  border-radius: .3rem;
  font-family: inherit;
  padding: .4rem .6rem;
  font-size: .9rem;
}

#gemini-form textarea {
  resize: vertical;
  min-height: 100px;
}

#gemini-form button[type="submit"] {
  background: #673ab7;
  color: white;
  border: none;
  padding: .6rem 1.2rem;
  border-radius: .3rem;
  cursor: pointer;
  font-size: .9rem;
  font-weight: bold;
}

#gemini-form button[type="submit"]:hover {
  background: #512da8;
}

.result-item {
  transition: all 0.2s ease;
}

.result-item:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

#search-input {
  flex: 1;
  min-width: 200px;
}

#refresh-btn {
  background: #17a2b8;
  color: white;
  border: none;
  padding: .4rem .8rem;
  border-radius: .3rem;
  cursor: pointer;
  font-size: .9rem;
}

#refresh-btn:hover {
  background: #138496;
}

details {
  margin-top: 2rem;
  border: 1px solid #e0e0e0;
  border-radius: .5rem;
  padding: 1rem;
}

details summary {
  cursor: pointer;
  font-weight: bold;
  color: #673ab7;
}

/* ================================
   Graph Styles
   ================================ */

.graphs-section {
  margin-bottom: 2rem;
}

.graph-controls {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: .4rem;
  border: 1px solid #e9ecef;
}

.graph-controls label {
  font-weight: bold;
  margin-right: .5rem;
}

.graph-controls select {
  padding: .4rem .8rem;
  border: 1px solid #ddd;
  border-radius: .3rem;
  background: white;
  font-size: .9rem;
  min-width: 200px;
}

.graph-container {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: .5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  border-left: 4px solid #2196F3;
}

.graph-container h3 {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #333;
  font-size: 1.1rem;
  font-weight: bold;
}

.chart-container {
  position: relative;
  height: 400px;
  width: 100%;
}

.chart-container:empty::after {
  content: "グラフデータを読み込み中...";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #666;
  font-style: italic;
}

/* Chart container responsive sizing */
@media (max-width: 768px) {
  .chart-container {
    height: 300px;
  }
  
  .graph-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .graph-controls select {
    min-width: 100%;
  }
}
