:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #0b74c8;
  --primary-light: #0ea5e9;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* Header Styles */
.header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 70px;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

.brand a {
  text-decoration: none;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: color 0.3s ease;
}

.brand a:hover {
  color: var(--primary);
}

.brand-icon-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 10px;
  color: white;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(11, 116, 200, 0.3);
}

.brand-text {
  display: none;
  font-weight: 700;
  font-size: 16px;
}

@media (min-width: 640px) {
  .brand-text {
    display: inline;
  }
}

/* Menu Toggle Button */
.menu-toggle {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin: -8px;
  transition: all 0.3s ease;
}

.menu-toggle span {
  width: 24px;
  height: 2.5px;
  background: var(--text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(10px, 10px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

@media (min-width: 768px) {
  .menu-toggle {
    display: none;
  }
}

/* Navigation Bar */
.navbar {
  display: none;
  position: absolute;
  top: 70px;
  left: 0;
  right: 0;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-direction: column;
  padding: 20px;
  gap: 20px;
  animation: slideDown 0.3s ease;
}

.navbar.active {
  display: flex;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 768px) {
  .navbar {
    display: flex !important;
    position: static;
    background: transparent;
    border: none;
    padding: 0;
    gap: 0;
    flex-direction: row;
    align-items: center;
    flex: 1;
    margin-left: 20px;
    animation: none;
  }
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 768px) {
  .nav-menu {
    display: flex;
    flex-direction: row;
    gap: 5px;
    flex: 1;
  }
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  transition: all 0.3s ease;
  white-space: nowrap;
  font-weight: 500;
  position: relative;
}

.nav-link::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.3s ease;
}

.nav-link i {
  font-size: 16px;
  flex-shrink: 0;
}

.nav-link:hover {
  background: rgba(11, 116, 200, 0.1);
  color: var(--primary);
}

.nav-link:hover::before {
  width: 100%;
}

.nav-link span {
  display: inline;
}

@media (min-width: 768px) {
  .brand-text {
    display: inline;
  }
  
  .nav-link {
    padding: 8px 12px;
  }

  .nav-link i {
    display: none;
  }

  .nav-link:hover {
    background: rgba(11, 116, 200, 0.06);
    border-color: var(--primary);
  }
  
  .nav-link::before {
    height: 3px;
    bottom: -4px;
  }
  
  .badge span {
    max-width: 160px;
  }
}

.user-section {
  display: flex;
  flex-direction: column;
  gap: 15px;
  border-top: 1px solid var(--border);
  padding-top: 15px;
  order: 2;
}

@media (min-width: 768px) {
  .user-section {
    border-top: none;
    padding-top: 0;
    border-left: 1px solid var(--border);
    padding-left: 20px;
    margin-left: auto;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    order: 0;
  }
}

.user-badges {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (min-width: 768px) {
  .user-badges {
    flex-direction: row;
    gap: 8px;
  }
}

.logout-link {
  border-top: 1px solid var(--border);
  padding-top: 15px;
  margin-top: 10px;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 8px;
}

.logout-link i {
  font-size: 16px;
}

.logout-link:hover {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

@media (min-width: 768px) {
  .logout-link {
    border: none;
    padding: 10px 12px;
    margin: 0;
  }
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
  background: rgba(229, 231, 235, 0.4);
  color: var(--text);
}

.badge i {
  font-size: 16px;
  flex-shrink: 0;
  opacity: 0.8;
}

.badge span {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  max-width: 120px;
}

.badge.success {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success);
}

.badge.success i {
  opacity: 1;
  color: var(--success);
}

.badge.danger {
  background: rgba(239, 68, 68, 0.12);
  color: var(--danger);
}

.badge.danger i {
  opacity: 1;
  color: var(--danger);
}

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

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: rgba(11, 116, 200, 0.2);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}

.col-6 {
  grid-column: span 6;
}
.col-12 {
  grid-column: span 12;
}

@media (max-width: 820px) {
  .col-6 {
    grid-column: span 12;
  }
}

h1,
h2,
h3 {
  margin: 0 0 12px 0;
  line-height: 1.3;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 24px;
}

h3 {
  font-size: 20px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
}
.form-group {
  grid-column: span 6;
}
.form-group.full {
  grid-column: span 12;
}
label {
  display: block;
  font-weight: 700;
  margin-bottom: 6px;
}
input,
select,
textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  outline: none;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
  transition: all 0.3s ease;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 116, 200, 0.1);
}
textarea {
  min-height: 110px;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 8px;
  border: none;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.btn:hover:not(:disabled) {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn.secondary {
  background: var(--text);
  color: #fff;
}

.btn.secondary:hover:not(:disabled) {
  background: rgba(15, 23, 42, 0.8);
}

.btn.light {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border);
}

.btn.light:hover:not(:disabled) {
  background: var(--bg);
  border-color: var(--primary);
}

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

.btn.danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.alert {
  padding: 14px 16px;
  border-radius: 8px;
  margin: 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideDown 0.3s ease;
}

.alert i {
  font-size: 18px;
  flex-shrink: 0;
}

.alert.success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
  border-left: 4px solid var(--success);
}

.alert.error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--danger);
  border-left: 4px solid var(--danger);
}

.cards {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.subject-card {
  grid-column: span 4;
  cursor: pointer;
  transition: all 0.3s ease;
}

.subject-card:hover {
  transform: translateY(-4px);
}

.subject-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  gap: 8px;
  font-size: 13px;
}

.subject-card .actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.small {
  font-size: 13px;
}

.copy-input {
  position: absolute;
  left: -9999px;
}

/* Main Content Area */
.main-content {
  min-height: calc(100vh - 70px);
  padding: 20px 0;
}

/* Login Page Styles */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 70px);
  padding: 20px;
  background: linear-gradient(135deg, rgba(11, 116, 200, 0.05) 0%, rgba(14, 165, 233, 0.05) 100%);
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  animation: slideUp 0.5s ease;
}

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

.login-header {
  text-align: center;
  margin-bottom: 30px;
}

.login-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  border-radius: 14px;
  color: white;
  font-size: 28px;
  margin: 0 auto 16px;
  box-shadow: 0 8px 20px rgba(11, 116, 200, 0.3);
}

.login-header h2 {
  margin: 0 0 8px 0;
  font-size: 26px;
  color: var(--text);
}

.login-header .muted {
  margin: 0;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.login-form label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.login-form label i {
  font-size: 16px;
  color: var(--primary);
  min-width: 18px;
}

.login-form input {
  padding: 12px 14px;
  font-size: 14px;
}

.login-form input::placeholder {
  color: var(--muted);
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  transition: all 0.3s ease;
  padding: 8px;
  margin: -8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.password-toggle:hover {
  color: var(--primary);
  transform: scale(1.1);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  font-weight: 700;
  padding: 14px 18px;
  font-size: 16px;
  margin-top: 10px;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 12px 25px rgba(11, 116, 200, 0.4);
  transform: translateY(-3px);
}

.login-footer {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.login-footer .muted {
  margin: 0 0 12px 0;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--primary);
  font-weight: 600;
  padding: 10px 14px;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: 1px solid rgba(11, 116, 200, 0.2);
}

.btn-link:hover {
  background: rgba(11, 116, 200, 0.1);
  border-color: var(--primary);
}

.btn-link i {
  font-size: 14px;
}

@media (max-width: 640px) {
  .login-card {
    padding: 30px 20px;
  }
  
  .login-header h2 {
    font-size: 22px;
  }
  
  .login-form {
    gap: 16px;
  }
}

@media (max-width: 1020px) {
  .subject-card {
    grid-column: span 6;
  }
}

@media (max-width: 640px) {
  .subject-card {
    grid-column: span 12;
  }
  
  .container {
    padding: 16px;
  }
  
  h1 {
    font-size: 24px;
  }
  
  h2 {
    font-size: 20px;
  }
}
