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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #f5f7fa;
  color: #2c3e50;
}

.hidden { display: none !important; }

/* Login Screen */
.login-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.logo {
  text-align: center;
  color: white;
  margin-bottom: 40px;
}

.logo h1 {
  font-size: 48px;
  margin-bottom: 10px;
}

.logo p {
  font-size: 18px;
  opacity: 0.9;
}

.login-form {
  background: white;
  padding: 40px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  width: 100%;
  max-width: 400px;
}

.login-form h2 {
  margin-bottom: 20px;
  color: #2c3e50;
}

.login-form input {
  width: 100%;
  padding: 12px;
  margin-bottom: 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  transition: border-color 0.3s;
}

.login-form input:focus {
  outline: none;
  border-color: #667eea;
}

#descope-container {
  margin-top: 20px;
}

#descope-flow {
  width: 100%;
}

.loading {
  color: #666;
  text-align: center;
  padding: 20px;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger, .btn-warning, .btn-text {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: #667eea;
  color: white;
  width: 100%;
  margin-bottom: 10px;
}

.btn-primary:hover {
  background: #5568d3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102,126,234,0.4);
}

.btn-secondary {
  background: white;
  color: #667eea;
  border: 2px solid #667eea;
  width: 100%;
}

.btn-secondary:hover {
  background: #f8f9ff;
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
}

.btn-warning {
  background: #f39c12;
  color: white;
}

.btn-warning:hover {
  background: #e67e22;
}

.btn-text {
  background: transparent;
  color: white;
  padding: 8px 16px;
}

.error-message {
  color: #e74c3c;
  text-align: center;
  margin-top: 15px;
}

/* Navbar */
.navbar {
  background: white;
  padding: 15px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar h1 {
  font-size: 24px;
  color: #667eea;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Main Content */
.main-content {
  display: flex;
  min-height: calc(100vh - 70px);
}

.sidebar {
  width: 280px;
  background: white;
  padding: 30px 20px;
  box-shadow: 2px 0 10px rgba(0,0,0,0.05);
}

.sidebar h3 {
  margin-bottom: 20px;
  color: #2c3e50;
}

#classes-list {
  margin-bottom: 20px;
}

.class-item {
  padding: 15px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.class-item:hover {
  background: #e9ecef;
}

.class-item.active {
  background: #e3e8ff;
  border-color: #667eea;
}

.dashboard-main {
  flex: 1;
  padding: 40px;
}

.empty-state {
  text-align: center;
  padding: 100px 20px;
}

.empty-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.empty-state h2 {
  color: #2c3e50;
  margin-bottom: 10px;
}

.empty-state p {
  color: #7f8c8d;
}

/* Class View */
.class-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e0e0e0;
}

.join-code {
  color: #7f8c8d;
  margin-top: 5px;
}

.join-code strong {
  color: #667eea;
  font-size: 18px;
}

.class-actions {
  display: flex;
  gap: 10px;
}

/* Control Panel */
.control-panel {
  background: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 30px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.control-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #667eea;
}

input:checked + .slider:before {
  transform: translateX(26px);
}

/* Students Grid */
.students-grid h3 {
  margin-bottom: 20px;
  color: #2c3e50;
}

#students-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.student-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: all 0.3s;
  border: 2px solid transparent;
}

.student-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  border-color: #667eea;
}

.student-card.offline {
  opacity: 0.6;
}

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

.student-name {
  font-weight: 600;
  font-size: 18px;
  color: #2c3e50;
}

.status-indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #27ae60;
}

.status-indicator.offline {
  background: #95a5a6;
}

.current-tab {
  color: #7f8c8d;
  font-size: 14px;
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-count {
  color: #667eea;
  font-size: 14px;
  font-weight: 600;
}

/* Modals */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: white;
  border-radius: 16px;
  padding: 30px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-content.large {
  max-width: 700px;
}

.modal-content h2 {
  margin-bottom: 20px;
  color: #2c3e50;
}

.modal-content input,
.modal-content textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 20px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

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

.tabs-view {
  max-height: 400px;
  overflow-y: auto;
  margin-bottom: 20px;
}

.tab-item {
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tab-info {
  flex: 1;
  min-width: 0;
}

.tab-title {
  font-weight: 600;
  color: #2c3e50;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-url {
  font-size: 12px;
  color: #7f8c8d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-close {
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  cursor: pointer;
  font-size: 12px;
}

.tab-close:hover {
  background: #c0392b;
}

.student-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.student-actions button {
  flex: 1;
  min-width: 120px;
}
