/* ============================================
   COMPUTEC - Sistema de Soluciones Técnicas
   Escuela Superior Vocacional Pablo Colón Berdecia
   ============================================ */

:root {
  --blue-900: #1e3a5f;
  --blue-800: #1e40af;
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-400: #60a5fa;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;

  --bg: #f0f4f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
--text: #1e293b;
  --text-2: #475569;
  --text-3: #94a3b8;

  --green: #10b981;
  --yellow: #f59e0b;
  --red: #ef4444;
  --purple: #8b5cf6;
  --orange: #f97316;

  --sidebar-w: 260px;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12);

  --font: 'Sora', sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #162032;
  --border: #334155;
  --text: #f1f5f9;
  --text-2: #94a3b8;
  --text-3: #475569;
  --blue-50: #1e3a5f22;
  --blue-100: #1e3a5f44;
}

/* Responsive images */
img {
  max-width: 100%;
  height: auto;
}

/* Global responsive adjustments */
html {
  font-size: 16px;
}

@media (max-width: 480px) {
  html {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  html {
    font-size: 13px;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  transition: background .3s, color .3s;
  min-height: 100vh;
}

/* ======================== LOGIN ======================== */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #1e40af 100%);
}

.login-bg { position: absolute; inset: 0; z-index: 0; }

.login-grid {
  position: absolute; inset: 0;
  background-image: 
    linear-gradient(rgba(59,130,246,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,.08) 1px, transparent 1px);
  background-size: 40px 40px;
}

.login-orb {
  position: absolute; border-radius: 50%;
  filter: blur(80px); opacity: .4;
}
.orb1 { width: 400px; height: 400px; background: #3b82f6; top: -100px; right: -100px; animation: drift1 8s ease-in-out infinite; }
.orb2 { width: 300px; height: 300px; background: #8b5cf6; bottom: -80px; left: -80px; animation: drift2 10s ease-in-out infinite; }
.orb3 { width: 200px; height: 200px; background: #06b6d4; top: 50%; left: 50%; animation: drift3 7s ease-in-out infinite; }

@keyframes drift1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-30px,30px)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(30px,-20px)} }
@keyframes drift3 { 0%,100%{transform:translate(-50%,-50%)} 50%{transform:translate(-45%,-55%)} }

.login-card {
  position: relative; z-index: 1;
  background: rgba(255,255,255,.07);
  backdrop-filter: blur(24px);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 24px;
  padding: 48px;
  width: 100%; max-width: 440px;
  margin: 24px;
  box-shadow: 0 24px 80px rgba(0,0,0,.4);
  animation: slideUp .6s ease;
}

@media (max-width: 480px) {
  .login-card {
    padding: 32px 24px;
    margin: 16px;
    border-radius: 20px;
  }
}

@media (max-width: 360px) {
  .login-card {
    padding: 24px 20px;
    margin: 12px;
    border-radius: 16px;
  }
  .login-logo-img {
    width: 56px;
    height: auto;
    max-height: 56px;
  }
}

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

.login-logo { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; }
.login-logo-img {
  width: 72px;
  height: auto;
  max-height: 72px;
  object-fit: contain;
  border-radius: 10px;
}
.login-school { font-size: 11px; color: rgba(255,255,255,.6); text-transform: uppercase; letter-spacing: .8px; }
.login-school-name { font-size: 15px; font-weight: 700; color: #ffffff; line-height: 1.2; }
.login-dept { font-size: 11px; color: #60a5fa; margin-top: 2px; }

.login-title { font-size: 26px; font-weight: 800; color: white; margin-bottom: 6px; }
.login-sub { font-size: 13px; color: rgba(255,255,255,.5); margin-bottom: 32px; }

.login-card .form-group { margin-bottom: 20px; }
.login-card label { display: block; font-size: 13px; font-weight: 500; color: rgba(255,255,255,.7); margin-bottom: 8px; }

.input-wrap { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; pointer-events: none; z-index: 1; }
.input-icon path, .input-icon circle { fill: #ffffff; }
.input-wrap input {
  width: 100%;
  padding: 14px 14px 14px 44px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  color: #ffffff;
  font-family: var(--font);
  font-size: 14px;
  transition: all .2s;
  outline: none;
  box-shadow: none;
}

.input-wrap input::placeholder {
  color: rgba(255, 255, 255, 0.55);
}

.input-wrap input:focus {
  border-color: #3b82f6;
  background: rgba(96, 165, 250, 0.12);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.18);
}

.toggle-pass {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: rgba(255,255,255,0.6);
  padding: 4px; display: grid; place-items: center;
}
.toggle-pass svg { width: 18px; height: 18px; fill: #ffffff; }

.login-error { color: #fca5a5; font-size: 13px; margin-bottom: 8px; min-height: 20px; }

.btn-login {
  width: 100%; padding: 15px; background: linear-gradient(135deg, #3b82f6, #2563eb);
  border: none; border-radius: 10px; color: rgb(255, 255, 255); font-family: var(--font);
  font-size: 15px; font-weight: 600; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 10px; transition: all .2s;
  box-shadow: 0 4px 20px rgba(59,130,246,.4);
}
.btn-login svg { width: 18px; height: 18px; }
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(59,130,246,.5); }
.btn-login:active { transform: translateY(0); }

.btn-external {
  width: 100%; padding: 12px; margin-bottom: 12px;
  background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2);
  border-radius: 10px; color: rgba(255,255,255,0.8); font-family: var(--font);
  font-size: 14px; font-weight: 500; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; transition: all .2s;
}
.btn-external svg { width: 18px; height: 18px; }
.btn-external:hover { background: rgba(255,255,255,0.15); color: white; }

.login-footer { text-align: center; margin-top: 24px; font-size: 12px; color: rgba(255,255,255,0.4); }

.login-error { color: #dc2626; font-size: 13px; margin-bottom: 8px; min-height: 20px; }

/* ======================== APP LAYOUT ======================== */
.app { display: flex; height: 100vh; overflow: hidden; }
.hidden { display: none !important; }

@media (max-width: 900px) {
  .app {
    position: relative;
  }
}

@media (max-width: 600px) {
  .app {
    height: 100dvh;
    height: 100vh;
  }
}

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; transition: transform .3s;
  z-index: 100;
}

.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 12px; }

.logo-img {
  width: 56px;
  height: auto;
  max-height: 56px;
  border-radius: 10px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}
.sidebar-title { font-size: 16px; font-weight: 800; color: var(--blue-600); }
.sidebar-sub { font-size: 11px; color: var(--text-3); }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 10px; border: none; background: none; cursor: pointer;
  color: var(--text-2); font-family: var(--font); font-size: 14px; font-weight: 500;
  transition: all .15s; text-align: left; width: 100%;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--blue-50); color: var(--blue-600); }
.nav-item.active { background: var(--blue-600); color: white; }
.nav-item.active svg { color: white; }

.nav-badge {
  margin-left: auto; font-size: 10px; font-weight: 700; background: #f97316;
  color: white; padding: 2px 7px; border-radius: 20px; font-family: var(--mono);
}

.nav-divider { height: 1px; background: var(--border); margin: 8px 0; }
.nav-logout { color: var(--red) !important; }
.nav-logout:hover { background: #fee2e2 !important; }

.sidebar-user {
  padding: 16px 20px; border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--blue-600);
  color: white; display: grid; place-items: center; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role { font-size: 11px; color: var(--text-3); }

/* MAIN */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  height: 64px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px; flex-shrink: 0;
}
.menu-toggle {
  display: none; background: none; border: none; cursor: pointer; color: var(--text);
  padding: 8px; border-radius: 8px;
}
.menu-toggle svg { width: 22px; height: 22px; }

.topbar-title { flex: 1; }
.topbar-school { font-size: 14px; font-weight: 700; color: var(--blue-700); }
.topbar-dept { font-size: 12px; color: var(--text-3); }

.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 12px; color: var(--text-3); font-family: var(--mono); white-space: nowrap; }

.theme-toggle {
  background: none; border: none; cursor: pointer; color: var(--text-2);
  padding: 8px; border-radius: 8px; display: grid; place-items: center; transition: all .2s;
}
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle:hover { background: var(--blue-50); color: var(--blue-600); }

.content-area { flex: 1; overflow-y: auto; padding: 28px; }

/* SECTIONS */
.section { display: none; animation: fadeIn .3s ease; }
.section.active { display: block; }
@keyframes fadeIn { from{opacity:0;transform:translateY(8px)} to{opacity:1;transform:translateY(0)} }

.section-header { margin-bottom: 28px; }
.section-header h1 { font-size: 26px; font-weight: 800; color: var(--text); }
.section-header p { color: var(--text-2); margin-top: 4px; font-size: 14px; }

/* DASHBOARD STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
  background: var(--surface); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); border: 1px solid var(--border); transition: transform .2s;
  display: flex; align-items: center; gap: 16px;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon { width: 50px; height: 50px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.stat-icon svg { width: 24px; height: 24px; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--text); font-family: var(--mono); }
.stat-label { font-size: 12px; color: var(--text-2); margin-top: 2px; }

.dash-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.recent-card, .activity-card {
  background: var(--surface); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.recent-card h3, .activity-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 16px; }

.recent-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: none; }
.recent-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue-500); flex-shrink: 0; margin-top: 6px; }
.recent-title { font-size: 13px; font-weight: 500; color: var(--text); }
.recent-meta { font-size: 11px; color: var(--text-3); margin-top: 2px; }

.tech-chip {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.tech-chip:last-child { border-bottom: none; }
.tech-name { font-size: 13px; font-weight: 500; }
.tech-count {
  font-size: 12px; font-family: var(--mono); background: var(--blue-100);
  color: var(--blue-700); padding: 3px 10px; border-radius: 20px; font-weight: 600;
}

/* RECORDS */
.filters-bar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 20px;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--text-3); }
.search-wrap input {
  width: 100%; padding: 10px 12px 10px 38px; border: 1px solid var(--border);
  border-radius: 8px; font-family: var(--font); font-size: 14px; background: var(--surface);
  color: var(--text); outline: none; transition: all .2s;
}
.search-wrap input:focus { border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

.filters-bar select, .filters-bar input[type="date"] {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: 13px; background: var(--surface);
  color: var(--text); outline: none; cursor: pointer; min-width: 120px;
}

.btn-export {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-2); transition: all .2s; white-space: nowrap;
}
.btn-export svg { width: 15px; height: 15px; }
.btn-export:hover { background: var(--blue-50); color: var(--blue-600); border-color: var(--blue-400); }

.records-count { font-size: 13px; color: var(--text-3); margin-bottom: 16px; font-family: var(--mono); }

.records-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }

.record-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); overflow: hidden; transition: all .2s; cursor: pointer;
}
.record-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.record-card-header {
  padding: 16px 18px; display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px; border-bottom: 1px solid var(--border);
}
.record-tech { font-size: 14px; font-weight: 700; color: var(--text); }
.record-meta { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.record-badges { display: flex; flex-wrap: wrap; gap: 5px; }

.badge {
  font-size: 10px; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .5px; font-family: var(--mono);
}
.badge-blue { background: var(--blue-100); color: var(--blue-700); }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-orange { background: #fff7ed; color: #9a3412; }

.record-card-body { padding: 16px 18px; }
.record-problem { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 8px; }
.record-problem-text, .record-solution-text {
  font-size: 12px; color: var(--text-2); line-height: 1.6;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.record-solution-label { font-size: 11px; font-weight: 600; color: var(--green); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: .5px; }

.record-card-footer {
  padding: 12px 18px; border-top: 1px solid var(--border); display: flex; gap: 6px;
  background: var(--surface-2);
}
.btn-sm {
  padding: 6px 12px; border-radius: 6px; border: 1px solid var(--border);
  font-family: var(--font); font-size: 12px; font-weight: 500; cursor: pointer;
  display: flex; align-items: center; gap: 5px; transition: all .15s; background: var(--surface);
  color: var(--text-2);
}
.btn-sm svg { width: 13px; height: 13px; }
.btn-sm:hover { background: var(--blue-50); color: var(--blue-600); border-color: var(--blue-400); }
.btn-sm-danger:hover { background: #fee2e2; color: var(--red); border-color: #fca5a5; }
.btn-sm-green { background: var(--green) !important; color: white !important; border-color: var(--green) !important; }

/* FORM */
.form-container {
  background: var(--surface); border-radius: var(--radius); padding: 32px;
  box-shadow: var(--shadow); border: 1px solid var(--border); max-width: 900px;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
.full-width { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  padding: 11px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font); font-size: 14px; background: var(--surface-2);
  color: var(--text); outline: none; transition: all .2s; resize: vertical;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--blue-500); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

.upload-area {
  border: 2px dashed var(--border); border-radius: 10px; padding: 32px;
  text-align: center; cursor: pointer; transition: all .2s; color: var(--text-3);
}
.upload-area:hover { border-color: var(--blue-400); background: var(--blue-50); color: var(--blue-600); }
.upload-area svg { width: 44px; height: 44px; margin: 0 auto 12px; display: block; }
.upload-area p { font-size: 14px; font-weight: 500; }
.upload-area span { font-size: 12px; }

.image-preview-grid { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.preview-item {
  position: relative; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--border);
}
.preview-item img { width: 100px; height: 80px; object-fit: cover; display: block; }
.preview-remove {
  position: absolute; top: 4px; right: 4px; width: 20px; height: 20px;
  background: rgba(239,68,68,.9); border: none; border-radius: 50%; color: white;
  font-size: 12px; cursor: pointer; display: grid; place-items: center; font-weight: 700;
}

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

.btn-primary {
  display: flex; align-items: center; gap: 8px; padding: 12px 24px;
  background: var(--blue-600); border: none; border-radius: 8px; color: white;
  font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .2s; box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary svg { width: 16px; height: 16px; }
.btn-primary:hover { background: var(--blue-700); transform: translateY(-1px); }

.btn-secondary {
  display: flex; align-items: center; gap: 8px; padding: 12px 24px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px;
  color: var(--text-2); font-family: var(--font); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .2s;
}
.btn-secondary:hover { background: var(--bg); color: var(--text); }

/* STATS */
.stats-content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.chart-card {
  background: var(--surface); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.chart-card.full-width { grid-column: 1 / -1; }
.chart-card h3 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 18px; }
.chart-wrap { position: relative; height: 220px; }

/* AI */
.ai-container {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  height: calc(100vh - 240px); max-height: 700px; overflow: hidden;
}

.ai-chat-area { flex: 1; overflow-y: auto; padding: 24px; }

.ai-welcome { text-align: center; padding: 40px 20px; }
.ai-avatar-big {
  width: 80px; height: 80px; background: var(--blue-50); border-radius: 50%;
  display: grid; place-items: center; margin: 0 auto 20px; border: 2px solid var(--blue-100);
}
.ai-avatar-big svg { width: 40px; height: 40px; }
.ai-welcome h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.ai-welcome p { font-size: 14px; color: var(--text-2); max-width: 400px; margin: 0 auto 20px; }

.ai-suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ai-suggestions button {
  padding: 8px 16px; background: var(--blue-50); border: 1px solid var(--blue-100);
  border-radius: 20px; font-family: var(--font); font-size: 12px; color: var(--blue-700);
  cursor: pointer; transition: all .2s;
}
.ai-suggestions button:hover { background: var(--blue-100); }

.ai-message { margin-bottom: 16px; animation: msgIn .3s ease; }
@keyframes msgIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:translateY(0)} }

.ai-message.user { display: flex; justify-content: flex-end; }
.ai-message.user .ai-bubble {
  background: var(--blue-600); color: white; border-radius: 16px 16px 4px 16px;
  max-width: 75%;
}
.ai-message.ai .ai-bubble {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px; max-width: 85%;
}
.ai-bubble { padding: 14px 18px; font-size: 14px; line-height: 1.7; }

.ai-meta { font-size: 11px; color: var(--text-3); margin: 4px 8px; }

.ai-input-area { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.ai-input-area textarea {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-family: var(--font); font-size: 14px; background: var(--surface);
  color: var(--text); outline: none; resize: none; transition: border-color .2s;
}
.ai-input-area textarea:focus { border-color: var(--blue-500); }

.ai-input-actions { display: flex; gap: 10px; margin-top: 10px; justify-content: flex-end; }

.btn-ai-send {
  display: flex; align-items: center; gap: 8px; padding: 10px 20px;
  background: var(--blue-600); border: none; border-radius: 8px; color: white;
  font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer; transition: all .2s;
}
.btn-ai-send:hover { background: var(--blue-700); }
.btn-ai-send:disabled { opacity: .5; cursor: default; }
.btn-ai-send svg { width: 16px; height: 16px; }

.btn-use-in-form {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 8px;
  color: var(--text-2); font-family: var(--font); font-size: 13px; cursor: pointer; transition: all .2s;
}
.btn-use-in-form svg { width: 15px; height: 15px; }
.btn-use-in-form:hover { background: var(--blue-50); color: var(--blue-600); }

.ai-disclaimer {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(251, 191, 36, 0.1);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
}

.ai-loading { display: flex; gap: 6px; align-items: center; padding: 14px 18px; }
.ai-dot { width: 8px; height: 8px; background: var(--blue-400); border-radius: 50%; animation: bounce .8s infinite; }
.ai-dot:nth-child(2) { animation-delay: .15s; }
.ai-dot:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-8px)} }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 640px;
  max-height: 85vh; overflow-y: auto; box-shadow: var(--shadow-lg);
  animation: modalIn .25s ease;
}
@keyframes modalIn { from{opacity:0;transform:scale(.95)} to{opacity:1;transform:scale(1)} }

.modal-header {
  padding: 24px 28px 20px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none; border: none; cursor: pointer; color: var(--text-3);
  padding: 4px; border-radius: 6px; font-size: 20px;
  display: grid; place-items: center; width: 28px; height: 28px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 24px 28px; }

.modal-field { margin-bottom: 18px; }
.modal-field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--text-3); margin-bottom: 6px; }
.modal-field-value { font-size: 14px; color: var(--text); line-height: 1.6; }

.modal-images { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.modal-images img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: pointer; transition: transform .2s; }
.modal-images img:hover { transform: scale(1.05); }

/* CONFIRM */
.confirm-card {
  background: var(--surface); border-radius: 16px; padding: 36px; text-align: center;
  max-width: 380px; width: 100%; box-shadow: var(--shadow-lg); animation: modalIn .25s ease;
}
.confirm-icon { font-size: 40px; margin-bottom: 12px; }
.confirm-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.confirm-card p { font-size: 13px; color: var(--text-2); margin-bottom: 24px; }
.confirm-actions { display: flex; gap: 12px; justify-content: center; }
.btn-danger {
  padding: 10px 24px; background: var(--red); border: none; border-radius: 8px;
  color: white; font-family: var(--font); font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all .2s;
}
.btn-danger:hover { background: #dc2626; }

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

.toast {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 18px; box-shadow: var(--shadow-lg); display: flex; align-items: center;
  gap: 12px; min-width: 280px; animation: toastIn .3s ease;
  border-left: 4px solid var(--blue-500);
}
.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.warning { border-left-color: var(--yellow); }
@keyframes toastIn { from{opacity:0;transform:translateX(30px)} to{opacity:1;transform:translateX(0)} }
.toast-icon { font-size: 18px; }
.toast-text { font-size: 13px; font-weight: 500; flex: 1; }

/* RESPONSIVE - Tablet */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-bottom { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .stats-content-grid { grid-template-columns: 1fr; }
  .ai-container { height: auto; max-height: none; }
}

/* RESPONSIVE - Mobile Large */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: grid; }
  .dash-bottom { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .stats-content-grid { grid-template-columns: 1fr; }
  .records-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; max-width: 400px; }
  .login-logo { flex-direction: column; text-align: center; gap: 12px; }
  .login-school-name { font-size: 14px; }
  .login-title { font-size: 22px; }
  .topbar-dept { display: none; }
  .ai-suggestions { flex-direction: column; align-items: center; }
}

/* RESPONSIVE - Mobile Small */
@media (max-width: 600px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-container { padding: 20px 16px; margin: 0 -8px; border-radius: 16px; }
  .content-area { padding: 16px 12px; }
  .topbar-school { font-size: 12px; }
  .topbar-dept { display: none; }
  .topbar { padding: 0 12px; gap: 10px; }
  .filters-bar { flex-direction: column; }
  .filters-bar > * { width: 100%; }
  .filters-bar select, .filters-bar input[type="date"] { width: 100%; }
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
  .stat-num { font-size: 24px; }
  .section-header h1 { font-size: 20px; }
  .section-header p { font-size: 13px; }
  .login-card { padding: 24px 20px; margin: 16px; }
  .login-logo-img { width: 56px; }
  .login-school { font-size: 10px; }
  .login-school-name { font-size: 13px; }
  .login-dept { font-size: 10px; }
  .login-title { font-size: 20px; }
  .btn-login, .btn-external { padding: 12px; font-size: 14px; }
  .btn-primary, .btn-secondary { padding: 10px 16px; font-size: 13px; }
  .form-group input, .form-group select, .form-group textarea { padding: 10px 12px; font-size: 13px; }
  .form-actions { flex-direction: column; }
  .form-actions button { width: 100%; justify-content: center; }
  .modal-card { max-width: 100%; margin: 12px; }
  .modal-header { padding: 16px 20px; }
  .modal-body { padding: 16px 20px; }
  .ai-container { border-radius: 12px; }
  .ai-chat-area { padding: 16px; }
  .ai-welcome { padding: 24px 16px; }
  .ai-input-area { padding: 12px 16px; }
  .ai-input-actions { flex-direction: column; }
  .ai-input-actions button { width: 100%; justify-content: center; }
  .ai-message.user .ai-bubble { max-width: 90%; }
  .ai-message.ai .ai-bubble { max-width: 95%; }
  .record-card { border-radius: 10px; }
  .record-card-header { padding: 12px 14px; }
  .record-card-body { padding: 12px 14px; }
  .record-card-footer { padding: 10px 14px; flex-wrap: wrap; }
  .confirm-card { padding: 24px 20px; margin: 16px; }
  .confirm-actions { flex-direction: column; }
  .confirm-actions button { width: 100%; }
  .btn-danger, .btn-secondary { justify-content: center; }
  .toast-container { left: 12px; right: 12px; }
  .toast { min-width: auto; width: 100%; }
  .upload-area { padding: 24px 16px; }
  .image-preview-grid { justify-content: center; }
  .preview-item img { width: 80px; height: 65px; }
}

/* RESPONSIVE - Extra Small */
@media (max-width: 400px) {
  .login-card { padding: 20px 16px; }
  .login-logo { gap: 8px; }
  .login-school, .login-dept { font-size: 9px; }
  .login-title { font-size: 18px; }
  .login-sub { font-size: 12px; margin-bottom: 24px; }
  .content-area { padding: 12px 8px; }
  .stats-grid { gap: 12px; }
  .stat-card { gap: 12px; padding: 14px; }
  .stat-icon { width: 40px; height: 40px; }
  .stat-icon svg { width: 20px; height: 20px; }
  .stat-num { font-size: 20px; }
  .stat-label { font-size: 11px; }
  .section-header { margin-bottom: 20px; }
  .section-header h1 { font-size: 18px; }
  .filters-bar { gap: 8px; }
  .btn-export { justify-content: center; }
  .recent-card, .activity-card { padding: 16px; }
  .recent-card h3, .activity-card h3 { font-size: 14px; }
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 99;
  opacity: 0; visibility: hidden; transition: all .3s;
}
.sidebar-overlay.open { opacity: 1; visibility: visible; }
@media (min-width: 901px) {
  .sidebar-overlay { display: none; }
}

/* Ensure proper touch targets on mobile */
@media (pointer: coarse) {
  .nav-item, .btn-login, .btn-primary, .btn-secondary, .btn-export, .menu-toggle, .theme-toggle {
    min-height: 44px;
  }
  .form-group input, .form-group select, .form-group textarea, .search-wrap input {
    min-height: 44px;
  }
}

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty-state svg { width: 64px; height: 64px; margin: 0 auto 16px; display: block; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* STATUS DOT */
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.dot-green { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red { background: var(--red); }

/* Copy button */
.copy-btn {
  padding: 4px 10px; font-size: 11px; background: var(--bg);
  border: 1px solid var(--border); border-radius: 5px; cursor: pointer;
  color: var(--text-2); font-family: var(--mono); transition: all .2s;
}
.copy-btn:hover { background: var(--blue-50); color: var(--blue-600); }
.input-wrap {
  position: relative !important;
}

.input-wrap .input-icon {
  position: absolute !important;
  left: 18px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 18px !important;
  height: 18px !important;
  color: rgba(0, 0, 0, 0.82) !important;
  fill: currentColor !important;
  pointer-events: none !important;
  z-index: 5 !important;
}

.input-wrap input {
  padding-left: 58px !important;
  padding-right: 46px !important;
  height: 48px !important;
  line-height: 48px !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #000000 !important;
  caret-color: #ffffff !important;
}

.input-wrap input::placeholder {
  color: rgba(255, 255, 255, 0.55) !important;
}

.input-wrap .toggle-pass {
  position: absolute !important;
  right: 14px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  z-index: 6 !important;
  color: rgba(0, 0, 0, 0.82) !important;
}

.input-wrap .toggle-pass svg {
  fill: currentColor !important;
}