/* Kuttanad Farm Dashboard - Mobile-First Design */

/* Google Font Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Custom Properties */
:root {
  --primary-color: #1B5E20;
  --secondary-color: #E8F5E9;
  --primary-dark: #0d3f13;
  --primary-light: #2e7d32;
  --text-primary: #212121;
  --text-secondary: #757575;
  --text-light: #FFFFFF;
  --border-color: #E0E0E0;
  --error-color: #D32F2F;
  --warning-color: #F57C00;
  --success-color: #388E3C;
  --info-color: #1976D2;
  --background: #FAFAFA;
  --card-background: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.12);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 20px rgba(0,0,0,0.15);
  --border-radius: 8px;
  --transition: all 0.3s ease;
}

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

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  background-color: var(--background);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header & Navigation */
header {
  background-color: var(--primary-color);
  color: var(--text-light);
  padding: 1rem;
  box-shadow: var(--shadow-md);
  position: sticky;
  top: 0;
  z-index: 1000;
}

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

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

nav a {
  color: var(--text-light);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius);
  display: block;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  transition: var(--transition);
}

nav a:hover,
nav a.active {
  background-color: var(--primary-dark);
}

/* Main Content */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 1rem;
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* Cards */
.card {
  background: var(--card-background);
  border-radius: var(--border-radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--primary-color);
}

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

/* Grid Layouts */
.grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: var(--transition);
  white-space: nowrap;
}

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

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

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

.btn-secondary:hover {
  background-color: var(--primary-color);
  color: var(--text-light);
}

.btn-danger {
  background-color: var(--error-color);
  color: var(--text-light);
}

.btn-danger:hover {
  background-color: #B71C1C;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-block {
  display: block;
  width: 100%;
}

.btn-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

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

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

input,
select,
textarea {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.875rem;
  font-family: 'Inter', sans-serif;
  transition: var(--transition);
}

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

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

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

@media (min-width: 768px) {
  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background-color: var(--secondary-color);
}

th {
  padding: 0.75rem 0.5rem;
  text-align: left;
  font-weight: 600;
  color: var(--primary-color);
  white-space: nowrap;
}

td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background-color: var(--secondary-color);
}

/* Badges & Status */
.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background-color: #C8E6C9;
  color: #2E7D32;
}

.badge-warning {
  background-color: #FFE0B2;
  color: #E65100;
}

.badge-danger {
  background-color: #FFCDD2;
  color: #C62828;
}

.badge-info {
  background-color: #BBDEFB;
  color: #1565C0;
}

.badge-default {
  background-color: #E0E0E0;
  color: #616161;
}

/* Stats */
.stat-card {
  text-align: center;
  padding: 1rem;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-color);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Alerts */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  font-size: 0.875rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.alert-success {
  background-color: #C8E6C9;
  color: #2E7D32;
  border-left: 4px solid #2E7D32;
}

.alert-warning {
  background-color: #FFE0B2;
  color: #E65100;
  border-left: 4px solid #E65100;
}

.alert-danger {
  background-color: #FFCDD2;
  color: #C62828;
  border-left: 4px solid #C62828;
}

.alert-info {
  background-color: #BBDEFB;
  color: #1565C0;
  border-left: 4px solid #1565C0;
}

/* Lists */
.list-item {
  padding: 0.875rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.list-item-meta {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tab {
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: var(--transition);
  white-space: nowrap;
}

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

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

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.3s;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal-content {
  background-color: var(--card-background);
  border-radius: var(--border-radius);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.3s;
}

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

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-body {
  padding: 1.25rem;
}

.modal-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* Footer */
footer {
  background-color: var(--primary-color);
  color: var(--text-light);
  padding: 1.5rem 1rem;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}

.footer-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.footer-info {
  font-size: 0.875rem;
  opacity: 0.9;
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-muted {
  color: var(--text-secondary);
}

.text-success {
  color: var(--success-color);
}

.text-danger {
  color: var(--error-color);
}

.text-warning {
  color: var(--warning-color);
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.mb-3 {
  margin-bottom: 1.5rem;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mt-3 {
  margin-top: 1.5rem;
}

.hidden {
  display: none !important;
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Loading Spinner */
.spinner {
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 2rem auto;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.empty-state-text {
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* Quick Actions */
.quick-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 0.5rem;
}

.quick-action-btn {
  flex: 1;
  min-width: 140px;
  padding: 1rem;
  background: var(--card-background);
  border: 2px solid var(--primary-color);
  border-radius: var(--border-radius);
  color: var(--primary-color);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.quick-action-btn:hover {
  background: var(--primary-color);
  color: var(--text-light);
}

/* Responsive Design */
@media (min-width: 768px) {
  .logo {
    font-size: 1.5rem;
  }

  nav a {
    font-size: 0.9375rem;
  }

  main {
    padding: 2rem;
  }

  .page-title {
    font-size: 2rem;
  }

  .card {
    padding: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .quick-actions {
    flex-wrap: nowrap;
  }
}
