:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --bg-color: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.7);
  --text-dark: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: rgba(255, 255, 255, 0.1);
}

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

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  background: radial-gradient(circle at top right, #1e293b, var(--bg-color));
}

/* Base Body para no Sidebar (Login) */
body.no-sidebar {
  flex-direction: column;
}

/* Sidebar styles */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 250px;
  height: 100vh;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--border-color);
  padding: 2rem 1rem;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-sizing: border-box;
  transition: width 0.3s ease, padding 0.3s ease;
}
.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 2rem;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}
.sidebar-cust-logo {
  transition: all 0.3s ease;
}
.sidebar-cust-logo img {
  display: block;
  margin: 0 auto;
}
.sidebar-user {
  text-align: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
  transition: opacity 0.3s ease;
  white-space: nowrap;
}
.sidebar-user .name {
  font-weight: 600;
  color: #fff;
}
.sidebar-user .role {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 0.25rem;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}
.nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.3s;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active {
  background: rgba(79, 70, 229, 0.2);
  color: #a78bfa;
}
.nav-link svg {
  margin-right: 0.75rem;
  width: 20px;
  height: 20px;
  min-width: 20px;
}
.nav-link span {
  transition: opacity 0.3s ease;
}
.logout-btn {
  margin-top: auto;
  color: #fca5a5 !important;
  background: rgba(239, 68, 68, 0.1);
}
.logout-btn:hover {
  background: rgba(239, 68, 68, 0.2) !important;
}

/* Sidebar Toggle */
.sidebar-toggle {
  position: absolute;
  top: 1.5rem;
  right: -15px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  z-index: 1001;
  transition: transform 0.3s ease;
}
.sidebar-toggle svg {
  width: 16px;
  height: 16px;
}

/* Minimized State */
body.sidebar-minimized .sidebar {
  width: 80px;
  padding: 2rem 0.6rem;
}
body.sidebar-minimized .sidebar-user,
body.sidebar-minimized .sidebar-cust-logo,
body.sidebar-minimized .sidebar-logo {
  display: none;
}
body.sidebar-minimized .nav-link span {
  display: none;
}
body.sidebar-minimized .nav-link {
  justify-content: center;
  padding: 0.85rem;
}
body.sidebar-minimized .nav-link svg {
  margin-right: 0;
  width: 24px;
  height: 24px;
}
body.sidebar-minimized .sidebar-toggle {
  transform: rotate(180deg);
}
body.sidebar-minimized .main-wrapper {
  margin-left: 80px;
  width: calc(100% - 80px);
}

/* Main Content Wrapper */
.main-wrapper {
  margin-left: 250px;
  width: calc(100% - 250px);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease, width 0.3s ease;
}

/* Utilities */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.center-flex {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.hidden {
  display: none !important;
}

/* Glassmorphism Card */
.glass-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.6);
}

/* Typography */
h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.02em;
}

.title {
  font-size: 1.75rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Button UI */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: background-color 0.2s, transform 0.1s;
}

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

.btn:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
}

/* Tables for Bitacora */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  backdrop-filter: blur(10px);
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.table th {
  padding: 1rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-color);
  background: rgba(15, 23, 42, 0.5);
}

.table td {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.95rem;
}

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

.table tbody tr {
  transition: background-color 0.2s;
}

.table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
}

/* Header/Topbar replacements */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.brand-accent {
  background: linear-gradient(90deg, #60a5fa, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Alert UI */
.alert {
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.alert-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Footer */
footer {
  text-align: center;
  padding: 1.5rem;
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}
