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

:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --secondary: #10B981;
  --background: #0F172A;
  --surface: #1E293B;
  --surface-light: rgba(30, 41, 59, 0.7);
  --text-main: #F8FAFC;
  --text-muted: #94A3B8;
  --border: #334155;
  --danger: #EF4444;
  --glass-bg: rgba(15, 23, 42, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --sidebar-width: 280px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--background);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Background Gradients */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background: radial-gradient(circle at 15% 50%, rgba(79, 70, 229, 0.15), transparent 25%),
              radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.1), transparent 25%);
  filter: blur(40px);
}

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

/* Glassmorphism Panels */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: 16px;
}

/* Inputs & Buttons */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.input-group label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.input-field {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  color: var(--text-main);
  font-size: 1rem;
  transition: all 0.3s ease;
  outline: none;
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
  background: rgba(15, 23, 42, 0.8);
}

.btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

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

.btn-secondary:hover {
  background: var(--surface);
  border-color: var(--text-muted);
}

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

.btn-danger:hover {
  background: var(--danger);
  color: white;
}

/* Login Page Specifics */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 40px;
  text-align: center;
  animation: slideUp 0.6s ease-out;
}

.login-logo {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #4F46E5, #10B981);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

.forgot-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.875rem;
  align-self: flex-end;
  margin-top: -12px;
  margin-bottom: 24px;
  transition: color 0.3s;
}

.forgot-link:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* Layout - Dashboard */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--surface-light);
  backdrop-filter: blur(20px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 0 24px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.nav-menu {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: all 0.2s ease;
}

.nav-item:hover, .nav-item.active {
  background: rgba(79, 70, 229, 0.1);
  color: var(--primary);
}

.nav-item i {
  font-size: 1.25rem;
}

.sidebar-footer {
  padding: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.2s;
}

.logout-btn:hover {
  color: var(--danger);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.top-header {
  height: 70px;
  background: var(--surface-light);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.header-actions {
  display: flex;
  gap: 16px;
}

.content-area {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
  position: relative;
}

/* Iframe Container */
.iframe-container {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px;
  background: white; /* Most old tools are light themed */
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  overflow: hidden;
}

.iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* Cards & Grid for Admin/Dashboard */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.card {
  padding: 24px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.3s ease, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.2);
  border-color: var(--primary);
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-main);
}

/* Tables for Admin */
.table-container {
  width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 16px 24px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: rgba(255, 255, 255, 0.02);
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

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

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Animations */
@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.animate-fade {
  animation: fadeIn 0.5s ease;
}

/* Utility classes */
.hidden { display: none !important; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 2000;
}

.toast {
  padding: 16px 24px;
  border-radius: 8px;
  background: var(--surface);
  color: white;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  border-left: 4px solid var(--primary);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
}

.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--secondary); }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}
