@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --accent: #1b4332;
  --surface: #d8f3dc;
  --text-primary: #212529;
  --text-secondary: #495057;
}

.dark {
  --bg-primary: #0b1c15;
  --bg-secondary: #1b4332;
  --accent: #52b788;
  --surface: #1b4332;
  --text-primary: #e9ecef;
  --text-secondary: #adb5bd;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s, color 0.3s;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

body > .flex {
  flex: 1;
  overflow: hidden;
  display: flex;
}

body > .flex > main {
  overflow-y: auto;
  height: 100%;
}

body > footer {
  flex-shrink: 0;
}

.bg-brand { background-color: var(--accent); }
.bg-surface { background-color: var(--surface); }
.bg-frame { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.text-brand { color: var(--accent); }
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.border-brand { border-color: var(--accent); }

.btn-primary {
  background-color: var(--accent);
  color: white;
  padding: 0.5rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background-color: var(--surface);
  color: var(--text-primary);
  padding: 0.5rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  border: 1px solid var(--accent);
}

.card {
  background-color: var(--bg-secondary);
  border-radius: 0.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid rgba(0,0,0,0.05);
}

.dark .card {
  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.05);
}

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background-color: var(--bg-primary);
  color: var(--text-primary);
}

.dark .form-input {
  border-color: #4b5563;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(0,0,0,0.1);
}

.dark th, .dark td {
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-link {
  display: block;
  padding: 0.625rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.sidebar-link:hover, .sidebar-link.active {
  background-color: var(--surface);
  color: var(--accent);
}

@media (min-width: 1024px) {
  main.flex-1 {
    margin-left: 16rem;
    transition: margin-left 0.2s;
  }
  body.sidebar-collapsed main.flex-1 {
    margin-left: 0;
  }
  body.sidebar-collapsed #expandBtn {
    display: flex !important;
  }
  #sidebar[data-collapsed="true"] {
    width: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }
}

@media (max-width: 1023px) {
  .card { padding: 1rem; }
  th, td { padding: 0.5rem; }
  .overflow-x-auto { -webkit-overflow-scrolling: touch; }
  table { min-width: 600px; }
}

@keyframes slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.animate-slide-in {
  animation: slide-in 0.3s ease-out;
}
