/* GCF Platform - Green Care Farm Certificata */
:root {
  --primary: #2d5a27;
  --primary-light: #4a8c3f;
  --primary-dark: #1a3d17;
  --secondary: #f4a012;
  --bg: #f5f7f5;
  --bg-card: #ffffff;
  --text: #333333;
  --text-light: #666666;
  --border: #e0e4e0;
  --success: #27ae60;
  --warning: #f39c12;
  --danger: #e74c3c;
  --info: #3498db;
  color-scheme: light;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app-container { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--primary-dark); color: white; position: fixed; height: 100vh; overflow-y: auto; z-index: 100; transition: transform 0.3s; }
.main-content { margin-left: 260px; flex: 1; min-height: 100vh; }
.page-header { background: white; padding: 20px 30px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.page-body { padding: 30px; }

/* Sidebar */
.sidebar-brand { padding: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: center; }
.sidebar-brand h2 { font-size: 16px; color: #a8d5a0; }
.sidebar-brand small { font-size: 11px; opacity: 0.7; }
.sidebar-nav { padding: 10px 0; }
.sidebar-nav a { display: flex; align-items: center; padding: 12px 20px; color: rgba(255,255,255,0.8); transition: all 0.2s; gap: 10px; font-size: 14px; position: relative; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: rgba(255,255,255,0.1); color: white; text-decoration: none; }
.sidebar-nav a.active { border-left: 3px solid var(--secondary); }
.sidebar-nav .nav-section { padding: 15px 20px 5px; font-size: 11px; text-transform: uppercase; opacity: 0.5; letter-spacing: 1px; }
.nav-badge { background: #e53935; color: white; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; margin-left: auto; animation: badgePulse 2s ease-in-out infinite; }
@keyframes badgePulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.sidebar-user { position: absolute; bottom: 0; width: 100%; padding: 15px 20px; border-top: 1px solid rgba(255,255,255,0.1); background: rgba(0,0,0,0.2); }
.sidebar-user .user-name { font-size: 13px; }
.sidebar-user .user-role { font-size: 11px; opacity: 0.6; }

/* Login Page */
.login-page { display: flex; justify-content: center; align-items: center; min-height: 100vh; min-height: 100dvh; background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%); }
.login-card { background: white; padding: 40px; border-radius: 12px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 100%; max-width: 420px; }
.login-card h1 { color: var(--primary); font-size: 24px; margin-bottom: 5px; }
.login-card .subtitle { color: var(--text-light); margin-bottom: 30px; font-size: 14px; }
.login-card .logo { text-align: center; margin-bottom: 20px; font-size: 40px; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14px; transition: border-color 0.2s; font-family: inherit;
  background-color: #fff; color: #333; color-scheme: light;
}
select, input, textarea { color-scheme: light; background-color: #fff; color: #333; }
option { background-color: #fff; color: #333; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(45,90,39,0.1);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 20px; border: none; border-radius: var(--radius); font-size: 14px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit; text-align: center; line-height: 1; box-sizing: border-box; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-group { display: flex; gap: 8px; }

/* Cards */
.card { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-header h3 { font-size: 16px; }
.card-body { padding: 20px; }
.card-footer { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border); }
.stat-card.clickable { cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; }
.stat-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); border-color: var(--primary); }
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-light); margin-top: 4px; }
.stat-card .stat-icon { font-size: 24px; float: right; opacity: 0.3; }

/* Tables */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; padding: 12px 16px; background: var(--bg); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); border-bottom: 2px solid var(--border); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
tr:hover td { background: rgba(45,90,39,0.03); }

/* Badges */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff3e0; color: #f57c00; }
.badge-danger { background: #fce4ec; color: #c62828; }
.badge-info { background: #e3f2fd; color: #1565c0; }
.badge-neutral { background: #f5f5f5; color: #666; }
.badge-C { background: #e8f5e9; color: #2e7d32; }
.badge-PC { background: #fff3e0; color: #f57c00; }
.badge-NC { background: #fce4ec; color: #c62828; }
.badge-NA { background: #f5f5f5; color: #666; }

/* Audit Checklist */
.audit-area { margin-bottom: 24px; }
.audit-area h3 { color: var(--primary); padding: 12px 16px; background: rgba(45,90,39,0.06); border-radius: var(--radius); margin-bottom: 12px; font-size: 15px; }
.audit-requirement { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; padding: 16px; background: white; }
.audit-requirement h4 { font-size: 14px; margin-bottom: 8px; }
.audit-requirement .question { font-size: 13px; color: var(--text-light); margin-bottom: 12px; font-style: italic; }
.eval-options { display: flex; gap: 8px; margin-bottom: 12px; }
.eval-option { padding: 8px 16px; border: 2px solid var(--border); border-radius: var(--radius); cursor: pointer; font-weight: 600; font-size: 13px; transition: all 0.2s; }
.eval-option:hover { border-color: var(--primary); }
.eval-option.selected-C { background: #e8f5e9; border-color: #2e7d32; color: #2e7d32; }
.eval-option.selected-PC { background: #fff3e0; border-color: #f57c00; color: #f57c00; }
.eval-option.selected-NC { background: #fce4ec; border-color: #c62828; color: #c62828; }
.eval-option.selected-NA { background: #f5f5f5; border-color: #999; color: #666; }
.evidence-checks { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.evidence-check { display: flex; align-items: center; gap: 4px; font-size: 12px; }
.evidence-check input[type="checkbox"] { accent-color: var(--primary); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert-warning { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }
.alert-danger { background: #fce4ec; color: #c62828; border: 1px solid #ef9a9a; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #90caf9; }

/* Tabs */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 20px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text-light); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all 0.2s; }
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Registry cards */
.org-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.org-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; transition: transform 0.2s; cursor: pointer; }
.org-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.12); }
.org-card-header { background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: white; padding: 16px; }
.org-card-header h3 { font-size: 16px; }
.org-card-header .cert-badge { background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 4px; font-size: 11px; margin-top: 4px; display: inline-block; }
.org-card-body { padding: 16px; }
.org-card-body p { font-size: 13px; color: var(--text-light); margin-bottom: 8px; }
.org-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.org-tag { background: var(--bg); padding: 2px 8px; border-radius: 4px; font-size: 11px; color: var(--text-light); }

/* Modal */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; justify-content: center; align-items: center; overflow-y: auto; }
.modal { background: white; border-radius: 12px; width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 18px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-light); padding: 0; line-height: 1; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* Loading */
.loading { text-align: center; padding: 40px; color: var(--text-light); }
.spinner { display: inline-block; width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast notifications */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 2000; }
.toast { padding: 12px 20px; border-radius: var(--radius); margin-bottom: 8px; font-size: 14px; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: slideIn 0.3s ease; min-width: 280px; }
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--info); color: white; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Empty state */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-light); }
.empty-state .icon { font-size: 48px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { margin-bottom: 8px; color: var(--text); }

/* Responsive */
@media (max-width: 768px) {
  /* Sidebar: overlay mode */
  .sidebar { transform: translateX(-100%); width: 280px; }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,0.3); }
  .main-content { margin-left: 0; }

  /* Sidebar overlay backdrop */
  .sidebar-backdrop {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); z-index: 99;
    display: none; -webkit-tap-highlight-color: transparent;
  }
  .sidebar-backdrop.visible { display: block; }

  /* Header compact */
  .page-header { padding: 12px 16px; }
  .page-header h2 { font-size: 16px; }
  .page-header .btn-sm { padding: 6px 10px; font-size: 11px; }

  /* Hamburger visible */
  .mobile-menu-btn { display: block !important; font-size: 22px; padding: 4px 8px; }

  /* Page body */
  .page-body { padding: 16px 12px; }

  /* Stats grid */
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 16px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-value { font-size: 24px; }
  .stat-card .stat-label { font-size: 11px; }
  .stat-card .stat-icon { font-size: 18px; }

  /* Forms single column */
  .form-row, .form-row-3 { grid-template-columns: 1fr !important; gap: 8px; }
  .form-group input, .form-group select, .form-group textarea { font-size: 16px !important; padding: 12px !important; }

  /* ALL selects and options on mobile — override inline styles */
  select { font-size: 16px !important; padding: 10px 12px !important; min-height: 44px !important; border-radius: 8px !important; background-color: #fff !important; color: #333 !important; -webkit-appearance: none; appearance: none; }
  option { font-size: 16px !important; padding: 10px 8px !important; background-color: #fff !important; color: #333 !important; }
  .confirm-modal select, .modal select, .modal-body select { font-size: 16px !important; padding: 10px 12px !important; min-height: 44px !important; width: 100% !important; background-color: #fff !important; color: #333 !important; }
  .confirm-modal input, .modal-body input, .confirm-modal textarea { font-size: 16px !important; padding: 10px 12px !important; min-height: 44px !important; }
  .confirm-modal label, .modal-body label { font-size: 14px !important; }

  /* Buttons touch-friendly */
  .btn { padding: 12px 18px; font-size: 14px; min-height: 44px; }
  .btn-sm { padding: 8px 14px; font-size: 13px; min-height: 38px; }
  .btn-group { flex-wrap: wrap; }

  /* Tables: horizontal scroll with hint */
  .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -12px; padding: 0 12px; }
  table { min-width: 600px; }
  th, td { padding: 10px 12px; font-size: 13px; white-space: nowrap; }

  /* Cards */
  .card-header { padding: 12px 16px; }
  .card-header h3 { font-size: 14px; }
  .card-body { padding: 16px; }

  /* Registry org grid */
  .org-grid { grid-template-columns: 1fr; gap: 12px; }

  /* Audit checklist */
  .eval-options { flex-wrap: wrap; gap: 6px; }
  .eval-option { padding: 10px 12px; font-size: 12px; flex: 1; min-width: calc(50% - 4px); text-align: center; justify-content: center; }
  .audit-requirement { padding: 12px; }
  .audit-requirement h4 { font-size: 13px; }
  .audit-area h3 { font-size: 14px; padding: 10px 12px; }
  .evidence-checks { gap: 6px; }

  /* Modal - scrollable on mobile */
  .modal-overlay { align-items: flex-start !important; padding: 20px 0; }
  .confirm-modal { width: 95% !important; max-width: none !important; padding: 24px 20px; margin: 20px auto; max-height: none; }
  .confirm-modal-actions { flex-direction: column; }
  .confirm-modal-actions .btn { min-width: auto; width: 100%; }
  .modal { width: 95% !important; max-width: none !important; }
  .modal-body { padding: 16px; }
  .modal-body .form-row { grid-template-columns: 1fr !important; }

  /* Login */
  .login-card { padding: 24px 20px; margin: 16px; }
  .login-page { min-height: 100vh; min-height: 100dvh; padding: 20px 0; align-items: flex-start; padding-top: 15vh; }
  .login-card h1 { font-size: 20px; }

  /* Toasts */
  .toast-container { top: 10px; right: 10px; left: 10px; }
  .toast { min-width: auto; font-size: 13px; padding: 10px 14px; }

  /* Empty state */
  .empty-state { padding: 40px 16px; }

  /* Flex utilities */
  .flex-between { flex-wrap: wrap; gap: 8px; }

  /* Sidebar user */
  .sidebar-user { position: relative; }

  /* Tabs */
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { white-space: nowrap; padding: 10px 14px; font-size: 13px; }
}

/* Extra small screens */
@media (max-width: 400px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
  .stat-card .stat-value { font-size: 22px; }
  .page-header h2 { font-size: 14px; }
  .eval-option { min-width: 100%; }
}

/* ===== RESPONSIVE CARD TABLES (mobile) ===== */
@media (max-width: 768px) {
  .card-table thead { display: none; }
  .card-table tr {
    display: block; margin-bottom: 12px; background: white;
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06); padding: 12px;
  }
  .card-table td {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid #f0f0f0;
    font-size: 13px; white-space: normal;
  }
  .card-table td:last-child { border-bottom: none; }
  .card-table td::before {
    content: attr(data-label);
    font-weight: 600; font-size: 12px; color: var(--text-light);
    text-transform: uppercase; letter-spacing: 0.3px;
    min-width: 100px; flex-shrink: 0; margin-right: 8px;
  }
  .card-table td:first-child { font-weight: 600; }
  .card-table td .btn { padding: 6px 10px; font-size: 12px; min-height: 32px; }
  .card-table td select { font-size: 14px !important; padding: 8px 10px !important; min-height: 38px !important; }
  .card-table { min-width: auto; }
}

.mobile-menu-btn { display: none; background: none; border: none; font-size: 24px; cursor: pointer; padding: 5px; }

/* Utility */
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-light); }
.text-sm { font-size: 12px; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; }
.hidden { display: none !important; }
.btn-eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 16px; padding: 4px; line-height: 1; }

/* Confirm Modal */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0); display: flex; align-items: center; justify-content: center;
  z-index: 2000; transition: background 0.2s ease; overflow-y: auto;
}
.modal-overlay.visible { background: rgba(0,0,0,0.5); }
.modal-overlay.visible .confirm-modal { transform: scale(1); opacity: 1; }
.confirm-modal {
  background: white; border-radius: 16px; padding: 32px; width: 90%; max-width: 380px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  transform: scale(0.9); opacity: 0; transition: all 0.2s ease;
}
.confirm-modal-icon { font-size: 40px; margin-bottom: 12px; }
.confirm-modal-title { font-size: 20px; font-weight: 700; color: #1a1a1a; margin: 0 0 8px 0; }
.confirm-modal-text { font-size: 14px; color: #666; margin: 0 0 24px 0; }
.confirm-modal-actions { display: flex; gap: 12px; justify-content: center; }
.confirm-modal-actions .btn { min-width: 120px; padding: 10px 24px; border-radius: 8px; font-weight: 600; font-size: 14px; line-height: 1; }
