/* --- EduAI Layout Redesign --- */
/* Base styles (Mobile First: Slide from Bottom) */
#eduai-drawer {
  position: fixed;
  left: 0;
  bottom: -100%;
  width: 100%;
  height: 90vh; /* Don't cover entire screen on mobile */
  background: white;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
  transition: bottom 0.3s ease;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}
#eduai-drawer.open {
  bottom: 0;
}
#eduai-drawer-header {
  padding: 0 16px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 100%;
  height: 48px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  z-index: 10;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}
.eduai-header-btn {
  cursor: pointer;
  padding: 8px;
  font-size: 20px;
  font-weight: 500;
  color: #1a1a1a;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
  background: transparent;
  border: none;
  margin-left: auto; /* Push to right if only child */
}
.eduai-header-btn:hover {
  opacity: 0.7;
}
#eduai-drawer-back {
  font-size: 24px;
}
#eduai-drawer-close {
  font-size: 28px;
}
#eduai-iframe-container {
  flex-grow: 1;
  position: relative;
}
#eduai-rate-limit-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  text-align: center;
  z-index: 100;
}
.rate-limit-content {
  max-width: 320px;
}
.rate-limit-title {
  font-size: 24px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 16px;
}
.rate-limit-text {
  font-size: 16px;
  color: #4b5563;
  line-height: 1.5;
  margin-bottom: 32px;
}
.eduai-login-btn {
  display: inline-block;
  padding: 12px 24px;
  background: #1a1a1a;
  color: #ffffff;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s;
  cursor: pointer;
  border: none;
  width: 100%;
}
.eduai-login-btn:hover {
  background: #000000;
}
#eduai-app-download-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 50;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}
.eduai-block-content {
  background: white;
  padding: 32px 24px;
  border-radius: 16px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  max-width: 320px;
  width: 100%;
}
.eduai-download-btn {
  display: inline-block;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: white;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  width: 100%;
  transition: transform 0.2s, box-shadow 0.2s;
  border: none;
  cursor: pointer;
  font-size: 15px;
  box-shadow: 0 4px 6px -1px rgba(139, 92, 246, 0.2), 0 2px 4px -1px rgba(139, 92, 246, 0.1);
}
.eduai-download-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 8px -1px rgba(139, 92, 246, 0.3), 0 4px 6px -1px rgba(139, 92, 246, 0.2);
}
#eduai-floating-button {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 500px; /* More responsive on larger screens like tablets */
  height: 56px;
  
  background-color: #000000;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 12px;
  
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 0 10px 0 24px;
  cursor: pointer;
  z-index: 1002;
  transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
  /* Cool Blue tight neon glow (Single Color) */
  box-shadow: 0 0 14px 2px rgba(6, 182, 212, 0.9);
}
#eduai-floating-button:hover {
  transform: translateX(-50%) scale(1.03);
  background-color: #050505;
  box-shadow: 0 0 18px 4px rgba(6, 182, 212, 1);
}
.eduai-input-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.eduai-placeholder {
  color: #f3f4f6; /* Very light text for contrast */
  font-size: 16px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
}
.eduai-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15); /* Slightly brighter for visibility */
  color: white;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: background 0.2s;
}
.eduai-send-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Mobile Action Buttons (Summarize & Quiz) */
#eduai-mobile-action-buttons {
  position: fixed;
  bottom: 86px; /* Positioned above the 56px trigger button + 24px bottom + 16px gap */
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  max-width: 500px; /* More responsive on larger screens like tablets */
  display: none; /* Mobile only */
  gap: 12px;
  z-index: 1002;
}
.eduai-action-btn {
  flex: 1;
  height: 48px;
  background: #000000;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.2s;
  white-space: nowrap;
}
.eduai-action-btn:hover {
  background-color: #000000;
  transform: scale(1.02);
}
.eduai-action-btn img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1); /* Ensure icons are white */
}

#eduai-summarize-btn {
  box-shadow: 0 0 12px 2px rgba(59, 130, 246, 0.7); /* Blue for Summary */
}
#eduai-summarize-btn:hover {
  box-shadow: 0 0 16px 3px rgba(59, 130, 246, 0.9);
}
#eduai-quiz-btn {
  box-shadow: 0 0 12px 2px rgba(34, 197, 94, 0.7); /* Green for Quiz */
}
#eduai-quiz-btn:hover {
  box-shadow: 0 0 16px 3px rgba(34, 197, 94, 0.9);
}

/* Desktop Overrides: Fixed Right Sidebar */
@media (min-width: 769px) {
  #eduai-drawer {
    right: 0;
    left: auto;
    bottom: auto;
    top: 56px; /* Start below the header (measured: 56px) */
    width: 400px;
    height: calc(100vh - 56px);
    border-radius: 0;
    box-shadow: -2px 0 15px rgba(0,0,0,0.05); /* Subtle shadow */
    border-left: 1px solid #e5e7eb;
    transition: none; /* Permanent on desktop, no animation */
    z-index: 30; /* Sit behind the header (which is z-40) to look seamless */
  }
  #eduai-drawer-header {
    display: none; /* Hide close button area on desktop */
  }
  #eduai-drawer-close {
    display: none; /* Keep close button hidden on desktop sidebar */
  }
  #eduai-floating-button {
    display: none !important; /* Force hide button on desktop */
  }
  
  /* Adjust main layout to make room for fixed sidebar */
  #tfile-section {
    width: calc(100% - 400px);
    padding-right: 20px;
  }
  #base-tfile-footer {
    width: calc(100% - 400px) !important;
  }
  #eduai-mobile-action-buttons {
    display: none !important;
  }
}

@media (max-width: 768px) {
  #eduai-mobile-action-buttons {
    display: flex;
  }
}
