/* Task Tracker - Common/Shared Styles */

/* CSS Variables - Root Theme */
:root {
  --bg-primary: #1a1a1a;
  --bg-secondary: #2d2d2d;
  --bg-tertiary: #3d3d3d;
  --text-primary: #ffffff;
  --text-secondary: #cccccc;
  --text-muted: #999999;
  --border: #444444;
  --accent-blue: #007acc;
  --accent-green: #16a34a;
  --accent-yellow: #ca8a04;
  --accent-red: #dc2626;
  --accent-purple: #9333ea;
}

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

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  padding-top: 70px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header Layout */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  transition: all 0.3s ease;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  position: relative;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-primary);
  z-index: 100;
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  max-width: 1200px;
  margin: 0 auto;
}

.header h1 {
  color: var(--accent-blue);
  font-size: 1.8rem;
  font-weight: 700;
  transition: font-size 0.3s ease;
}

/* Common Button Styles */
.btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:hover {
  transform: translateY(-1px);
}

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

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

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

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.btn-small {
  padding: 4px 8px;
  font-size: 0.8rem;
}

.btn-micro {
  padding: 2px 6px;
  font-size: 0.7rem;
  min-height: 32px;
  min-width: 60px;
}

/* Common Animations */
@keyframes pulse {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
  100% {
    opacity: 1;
  }
}

/* Utility Classes */
.text-muted {
  color: var(--text-muted);
}

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.error {
  background: #dc26264d;
  border: 1px solid var(--accent-red);
  color: var(--accent-red);
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 20px;
}

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

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

.modal-content {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: var(--accent-blue);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-body {
  padding: 16px;
}

.modal-footer {
  padding: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* Form Styles */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 12px;
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

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

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

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* Navigation Tabs */
.navigation-tabs {
  display: flex;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 2px;
  margin-bottom: 0px;
  gap: 2px;
}

.nav-tab {
  flex: 1;
  padding: 12px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  min-height: 44px;
}

.nav-tab:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-tab.active {
  background: var(--accent-blue);
  color: white;
}

/* Version Display */
.version-display {
  font-size: 0.7rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 4px 6px;
  border-radius: 4px;
  font-family: monospace;
  opacity: 0.8;
  border: 1px solid var(--border);
  position: absolute;
  top: 8px;
  right: 20px;
  z-index: 101;
}

/* Page Content */
.page-content {
  display: block;
}

.page-content[style*="display: none"] {
  display: none;
}

/* Add Task Floating Button */
.add-task-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--accent-blue);
  color: white;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 122, 204, 0.3);
  transition: all 0.2s ease;
  z-index: 100;
}

.add-task-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 122, 204, 0.4);
}

/* Responsive Breakpoints */
@media (max-width: 768px) {
  body {
    padding: 50px 10px 10px 10px;
  }

  .container {
    padding: 10px;
    max-width: none;
  }

  .header-top {
    flex-direction: column;
    gap: 8px;
    padding: 10px 15px;
    align-items: stretch;
  }

  .header h1 {
    font-size: 1.5rem;
    text-align: center;
  }

  .add-task-btn {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
    font-size: 1.3rem;
  }

  .version-display {
    top: 4px;
    right: 10px;
    font-size: 0.6rem;
    padding: 2px 4px;
  }

  /* Mobile Modal Optimizations */
  .modal-content {
    width: 98%;
    margin: 10px auto;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
    border-radius: 8px;
  }

  .modal-header {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
  }

  .modal-header h2 {
    font-size: 1.1rem;
    margin: 0;
  }

  .modal-close {
    width: 24px;
    height: 24px;
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 15px;
  }

  .form-group {
    margin-bottom: 12px;
  }

  .form-group label {
    margin-bottom: 4px;
    font-size: 0.85rem;
    font-weight: 500;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px;
    font-size: 16px; /* Prevents zoom on iOS */
    border-radius: 4px;
  }

  .form-group textarea {
    min-height: 60px;
    resize: none; /* Prevent resize on mobile */
  }

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

  .modal-footer {
    padding: 12px 15px;
    gap: 8px;
    flex-direction: row;
    justify-content: space-between;
  }

  .modal-footer .btn {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.9rem;
    justify-content: center;
  }
}

@media (min-width: 769px) {
  .header {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 20px;
    gap: 0;
  }

  .header-top {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
  }

  body {
    padding-top: 100px;
  }

  .container {
    padding: 20px;
  }

  /* Desktop Modal Styles */
  .modal-content {
    max-width: 500px;
    width: 85%;
  }

  .modal-header {
    padding: 15px 20px;
  }

  .modal-header h2 {
    font-size: 1.2rem;
  }

  .modal-body {
    padding: 20px;
  }

  .modal-footer {
    padding: 15px 20px;
    gap: 12px;
  }

  .modal-footer .btn {
    padding: 10px 20px;
    font-size: 0.9rem;
  }
}

@media (max-width: 480px) {
  .header-top {
    padding: 8px 10px;
  }

  .container {
    padding: 8px;
  }

  /* Ultra-compact modal for very small screens */
  .modal-content {
    width: 100%;
    height: 100vh;
    margin: 0;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-header {
    padding: 8px 12px;
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 10;
  }

  .modal-header h2 {
    font-size: 1rem;
  }

  .modal-body {
    padding: 8px;
    padding-bottom: 60px; /* Space for footer */
  }

  .form-group {
    margin-bottom: 8px;
  }

  .form-group label {
    font-size: 0.75rem;
    margin-bottom: 2px;
  }

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 8px;
    font-size: 16px;
  }

  .form-group textarea {
    min-height: 70px;
  }

  .modal-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
  }

  .modal-footer .btn {
    padding: 12px 16px;
    font-size: 0.9rem;
    min-height: 44px; /* Touch-friendly height */
  }

  /* Stack buttons vertically only for very small screens */
  @media (max-width: 400px) {
    .modal-footer {
      flex-direction: column;
    }

    .modal-footer .btn {
      width: 100%;
    }
  }
}