/* Main Stylesheet - Base Components */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-0);
  color: var(--text-0);
  line-height: 1.6;
  min-height: 100vh;
}

/* Layout Utilities */
.container-fluid {
  width: 100%;
  padding: 0 16px;
}

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

.row {
  display: flex;
  flex-wrap: wrap;
  margin: -8px;
}

.col {
  padding: 8px;
}

.col-12 { flex: 0 0 100%; max-width: 100%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-4 { flex: 0 0 33.333%; max-width: 33.333%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }

@media (max-width: 768px) {
  .col-md-12 { flex: 0 0 100%; max-width: 100%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
}

@media (max-width: 480px) {
  .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5em;
  color: var(--text-0);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

p {
  margin-bottom: 1em;
  color: var(--text-1);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--primary-2);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  gap: 8px;
}

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

.btn-primary:hover {
  background-color: var(--primary-2);
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.btn-secondary {
  background-color: var(--card);
  color: var(--text-0);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background-color: var(--card-2);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-1);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background-color: var(--card);
  color: var(--text-0);
}

.btn-small {
  padding: 8px 16px;
  font-size: 0.875rem;
}

.btn-large {
  padding: 16px 32px;
  font-size: 1.125rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Inputs */
.input-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-1);
  font-weight: 500;
  font-size: 0.875rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  background-color: var(--card);
  color: var(--text-0);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  transition: all 0.2s;
  font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(247, 146, 31, 0.1);
}

textarea {
  resize: vertical;
  min-height: 120px;
}

select {
  cursor: pointer;
}

/* Cards */
.card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.card-2 {
  background-color: var(--card-2);
}

.card-header {
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 12px;
  background-color: var(--card-2);
  color: var(--text-1);
}

.badge-primary {
  background-color: var(--primary);
  color: var(--primary-ink);
}

.badge-success {
  background-color: var(--success);
  color: #fff;
}

.badge-warning {
  background-color: var(--warning);
  color: #fff;
}

.badge-danger {
  background-color: var(--danger);
  color: #fff;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 12px 24px;
  background: none;
  border: none;
  color: var(--text-2);
  cursor: pointer;
  font-size: 1rem;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tab:hover {
  color: var(--text-1);
}

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

/* Accordion */
.accordion-item {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  background-color: var(--card);
}

.accordion-header {
  padding: 16px 20px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.accordion-content {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s, padding 0.3s;
}

.accordion-item.active .accordion-content {
  max-height: 1000px;
  padding: 0 20px 20px;
}

.accordion-icon {
  transition: transform 0.3s;
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background-color: var(--card);
  border-radius: var(--r-xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-soft);
  transform: scale(0.9);
  transition: transform 0.3s;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.5rem;
  margin: 0;
}

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

.modal-close:hover {
  background-color: var(--card-2);
  color: var(--text-0);
}

.modal-body {
  padding: 24px;
}

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

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-soft);
  min-width: 300px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-success {
  border-left: 4px solid var(--success);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

/* Header */
.header {
  background-color: var(--bg-1);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(10px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-0);
}

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

/* Footer */
.footer {
  background-color: var(--bg-1);
  border-top: 1px solid var(--border);
  padding: 48px 0 24px;
  margin-top: 80px;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-bottom: 32px;
}

.footer-section h4 {
  margin-bottom: 16px;
  font-size: 1rem;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 8px;
}

.footer-links a {
  color: var(--text-2);
  font-size: 0.875rem;
}

.footer-links a:hover {
  color: var(--text-1);
}

.footer-bottom {
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.875rem;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-0);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.mobile-menu-toggle:hover {
  background-color: var(--card);
}

.mobile-menu-toggle svg {
  display: block;
}

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

  .header-content {
    position: relative;
  }

  .mobile-menu-toggle {
    display: block;
  }

  .header-actions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--bg-1);
    border-top: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 12px;
    margin-top: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  }

  .header-actions.mobile-open {
    max-height: 500px;
    padding: 12px;
  }

  .header-actions .btn {
    width: 100%;
    justify-content: flex-start;
    margin-bottom: 8px;
    padding: 12px 16px;
    font-size: 1rem;
  }

  .header-actions .btn:last-child {
    margin-bottom: 0;
  }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.125rem; }

  .modal {
    max-width: 100%;
    margin: 0;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    max-height: 95vh;
  }

  .modal-overlay {
    padding: 0;
  }

  .card {
    padding: 16px;
  }

  .btn {
    padding: 14px 20px;
    font-size: 1rem;
    min-height: 44px; /* Touch-friendly */
  }

  .btn-small {
    padding: 10px 16px;
    font-size: 0.9375rem;
    min-height: 40px;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  textarea,
  select {
    padding: 14px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 44px; /* Touch-friendly */
  }

  textarea {
    min-height: 120px;
  }

  .footer {
    padding: 32px 0 20px;
    margin-top: 40px;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .footer-section {
    text-align: center;
  }

  .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
  }

  .footer-links li {
    margin-bottom: 0;
  }

  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }

  .toast {
    min-width: auto;
    width: 100%;
  }

  /* Tables - make scrollable on mobile */
  .card table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .card table thead,
  .card table tbody,
  .card table tr {
    display: table;
    width: 100%;
    table-layout: fixed;
  }

  .card table th,
  .card table td {
    padding: 10px 8px;
    font-size: 0.875rem;
  }

  /* Responsive grid adjustments */
  .row {
    margin: -6px;
  }

  .col {
    padding: 6px;
  }

  .col-6,
  .col-4,
  .col-3 {
    flex: 0 0 100%;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 10px;
  }

  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.375rem; }
  h3 { font-size: 1.125rem; }

  .card {
    padding: 12px;
    border-radius: var(--r-md);
  }

  .btn {
    padding: 12px 18px;
    font-size: 0.9375rem;
  }

  .logo {
    font-size: 1.25rem;
  }

  .footer {
    padding: 24px 0 16px;
  }

  .footer-section h4 {
    font-size: 0.9375rem;
    margin-bottom: 12px;
  }

  .footer-links {
    gap: 12px;
  }

  .footer-links a {
    font-size: 0.8125rem;
  }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.hidden { display: none; }





