/* styles.css - Livestock Herd/Flock Management Tool - 2026-02-08 */
:root {
  --navy: #0a1628;
  --navy-light: #142244;
  --navy-mid: #1a2d54;
  --navy-soft: #243a6b;
  --accent: #4a90d9;
  --accent-light: #6db3f8;
  --accent-glow: rgba(74, 144, 217, 0.15);
  --green: #27ae60;
  --green-light: #2ecc71;
  --red: #e74c3c;
  --red-light: #ff6b6b;
  --orange: #f39c12;
  --orange-light: #f1c40f;
  --purple: #9b59b6;
  --teal: #1abc9c;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1a1a2e;
  --text-light: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --shadow: 0 2px 8px rgba(10,22,40,0.08);
  --shadow-lg: 0 8px 30px rgba(10,22,40,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: 0.2s ease;
  --font-body: 'DM Sans', sans-serif;
  --font-display: 'Playfair Display', serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-body); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }

.app-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-mid) 50%, var(--navy-soft) 100%);
  color: white; padding: 28px 24px 20px; text-align: center; position: relative; overflow: hidden;
}
.app-banner::before {
  content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
  background: radial-gradient(ellipse at 30% 50%, rgba(74,144,217,0.08) 0%, transparent 60%); pointer-events: none;
}
.app-banner h1 { font-family: var(--font-display); font-size: clamp(1.4rem, 3.5vw, 2rem); font-weight: 800; margin-bottom: 8px; position: relative; }
.app-banner h1 i { margin-right: 10px; color: var(--accent-light); }
.app-banner .subtitle { font-size: 0.95rem; opacity: 0.85; max-width: 700px; margin: 0 auto; position: relative; }
.info-bar { background: var(--accent-glow); border-bottom: 1px solid var(--border); padding: 14px 24px; text-align: center; font-size: 0.88rem; color: var(--text-light); line-height: 1.5; }
.info-bar strong { color: var(--navy); }

.nav-container { background: white; border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow); }
.nav-tabs { display: flex; overflow-x: auto; max-width: 1200px; margin: 0 auto; padding: 0 8px; scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab { flex: 0 0 auto; padding: 14px 18px; font-size: 0.85rem; font-weight: 500; color: var(--text-light); cursor: pointer; border: none; background: none; border-bottom: 3px solid transparent; transition: all var(--transition); white-space: nowrap; display: flex; align-items: center; gap: 6px; font-family: var(--font-body); }
.nav-tab:hover { color: var(--accent); }
.nav-tab.active { color: var(--navy); border-bottom-color: var(--accent); font-weight: 600; }
.nav-tab i { font-size: 0.9rem; }

.main-content { max-width: 1200px; margin: 0 auto; padding: 20px 16px 100px; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.card { background: var(--card); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.card-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--navy); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.88rem; font-weight: 600; cursor: pointer; border: none; transition: all var(--transition); }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-light); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: var(--green-light); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: var(--red-light); }
.btn-outline { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 0.82rem; font-weight: 600; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.5px; }
.form-group input, .form-group select, .form-group textarea { padding: 10px 12px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.9rem; transition: border-color var(--transition); background: white; color: var(--text); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--accent); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-full { grid-column: 1 / -1; }

.stats-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat-card { background: white; border-radius: var(--radius-sm); padding: 16px; text-align: center; border: 1px solid var(--border); box-shadow: var(--shadow); }
.stat-card .stat-value { font-size: 1.8rem; font-weight: 700; color: var(--navy); line-height: 1.2; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 4px; }
.stat-card .stat-icon { font-size: 1.4rem; margin-bottom: 6px; color: var(--accent); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.data-table th { background: var(--navy); color: white; padding: 12px 14px; text-align: left; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: var(--accent-glow); }
.data-table .actions { white-space: nowrap; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-active { background: #d4edda; color: #155724; }
.badge-sold { background: #cce5ff; color: #004085; }
.badge-deceased { background: #f8d7da; color: #721c24; }
.badge-pending { background: #fff3cd; color: #856404; }
.badge-male { background: #d6e9ff; color: #1a5276; }
.badge-female { background: #fde2e4; color: #8b1a2b; }

.species-icon { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.85rem; color: white; margin-right: 6px; flex-shrink: 0; vertical-align: middle; }

.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10,22,40,0.6); z-index: 1000; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: white; border-radius: var(--radius); padding: 28px; max-width: 700px; width: 100%; max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg); position: relative; }
.modal-title { font-family: var(--font-display); font-size: 1.3rem; font-weight: 700; color: var(--navy); margin-bottom: 20px; padding-right: 30px; }
.modal-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border: none; background: var(--bg); border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1rem; color: var(--text-light); transition: all var(--transition); font-family: var(--font-body); }
.modal-close:hover { background: var(--red-light); color: white; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.search-box { flex: 1; min-width: 200px; padding: 10px 14px 10px 36px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.9rem; background-color: white; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: 10px center; background-size: 16px; }
.search-box:focus { outline: none; border-color: var(--accent); }
.filter-select { padding: 10px 14px; border: 2px solid var(--border); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.88rem; background: white; cursor: pointer; }

.chart-container { position: relative; width: 100%; max-width: 100%; margin: 16px 0; }
.chart-container canvas { width: 100% !important; max-height: 350px; }

.alert-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px; border-radius: var(--radius-sm); margin-bottom: 10px; border-left: 4px solid; }
.alert-urgent { background: #fef2f2; border-color: var(--red); }
.alert-warning { background: #fffbeb; border-color: var(--orange); }
.alert-info { background: #eff6ff; border-color: var(--accent); }
.alert-success { background: #f0fdf4; border-color: var(--green); }
.alert-item i { font-size: 1.2rem; margin-top: 2px; }
.alert-urgent i { color: var(--red); }
.alert-warning i { color: var(--orange); }
.alert-info i { color: var(--accent); }
.alert-success i { color: var(--green); }
.alert-item .alert-text { flex: 1; }
.alert-item .alert-title { font-weight: 600; font-size: 0.9rem; }
.alert-item .alert-desc { font-size: 0.82rem; color: var(--text-light); margin-top: 2px; }
.alert-item .alert-actions { flex-shrink: 0; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state i { font-size: 3rem; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-light); }

.app-footer { text-align: center; padding: 20px; font-size: 0.85rem; color: var(--text-muted); border-top: 1px solid var(--border); background: white; }
.app-footer a { color: var(--accent); text-decoration: none; }
.footer-brand { display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.footer-brand img { width: 20px; height: 20px; }

.confirm-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(10,22,40,0.6); z-index: 2000; align-items: center; justify-content: center; padding: 20px; }
.confirm-overlay.open { display: flex; }
.confirm-box { background: white; border-radius: var(--radius); padding: 28px; max-width: 400px; width: 100%; text-align: center; box-shadow: var(--shadow-lg); }
.confirm-box p { margin-bottom: 20px; font-size: 0.95rem; }
.confirm-box .confirm-actions { display: flex; gap: 10px; justify-content: center; }

.toast { position: fixed; bottom: 80px; right: 20px; background: var(--navy); color: white; padding: 14px 20px; border-radius: var(--radius-sm); font-size: 0.88rem; z-index: 3000; box-shadow: var(--shadow-lg); transform: translateY(100px); opacity: 0; transition: all 0.3s ease; }
.toast.show { transform: translateY(0); opacity: 1; }

.group-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 6px; flex-shrink: 0; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 16px; }
  .modal { padding: 20px; }
  .nav-tab { padding: 12px 12px; font-size: 0.8rem; }
  .toolbar { flex-direction: column; }
  .search-box { min-width: 100%; }
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 12px; }
  .stat-card .stat-value { font-size: 1.4rem; }
}
@media print {
  .nav-container, .app-banner, .info-bar, .btn, .toolbar, .app-footer { display: none !important; }
  .tab-panel { display: block !important; }
  .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}
