/* Premium Glass-Morphism Dark Theme - Matching Main Project */

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", sans-serif;
  background: radial-gradient(circle at top left, #111827 0, #020617 45%),
              radial-gradient(circle at bottom right, #020617 0, #000 55%);
  color: #e5e7eb;
  overflow: hidden;
}

.app-shell {
  display: flex;
  height: 100vh;
  width: 100%;
}

:root {
  --sidebar-width: 260px;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: radial-gradient(circle at top, #0b1120 0, #020617 60%);
  border-right: 1px solid rgba(15, 23, 42, 0.9);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1.5rem;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.9);
}

.sidebar-user {
  display: flex;
  flex-direction: column;
}

.sidebar-user-name {
  font-size: 0.9rem;
  font-weight: 600;
}

.sidebar-user-sub {
  font-size: 0.75rem;
  color: #9ca3af;
}

.sidebar-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #6b7280;
  margin: 1.1rem 0 0.35rem;
}

.nav-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 0.6rem;
  border-radius: 0.55rem;
  color: #9ca3af;
  text-decoration: none;
  font-size: 0.88rem;
  transition: all 0.15s ease-out;
}

.nav-item a .bi {
  font-size: 1rem;
  width: 18px;
  text-align: center;
}

.nav-item a .badge {
  margin-left: auto;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
}

.nav-item a:hover {
  background: #020617;
  color: #e5e7eb;
}

.nav-item a.active {
  background: linear-gradient(135deg, rgba(79, 70, 229, 0.16), transparent);
  border: 1px solid rgba(79, 70, 229, 0.55);
  color: #f9fafb;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.8);
}

.nav-item a.active .bi {
  color: #a5b4fc;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px dashed rgba(55, 65, 81, 0.8);
  font-size: 0.78rem;
  color: #6b7280;
}

/* Main Area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(24px);
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.9), #020617);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.85);
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.6));
}

.topbar-title {
  font-size: 0.9rem;
  font-weight: 500;
}

.topbar-sub {
  font-size: 0.76rem;
  color: #9ca3af;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Content Area */
.content-scroll {
  padding: 1.5rem;
  overflow-y: auto;
  height: calc(100vh - 60px);
}

.content-scroll::-webkit-scrollbar {
  width: 6px;
}

.content-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.content-scroll::-webkit-scrollbar-thumb {
  background: rgba(55, 65, 81, 0.5);
  border-radius: 3px;
}

/* Glass Cards */
.glass-card {
  background: radial-gradient(circle at top left, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.7));
  border: 1px solid rgba(55, 65, 81, 0.6);
  border-radius: 1rem;
  padding: 1.25rem;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f9fafb;
}

.card-sub {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.15rem;
}

.tiny-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(55, 65, 81, 0.6);
  font-size: 0.7rem;
  color: #9ca3af;
  white-space: nowrap;
}

.tiny-pill .bi {
  font-size: 0.75rem;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #f9fafb;
  line-height: 1;
}

.stat-label {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.35rem;
}

/* Mini Grid */
.mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.mini-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(55, 65, 81, 0.4);
  border-radius: 0.75rem;
  padding: 0.85rem;
}

.mini-label {
  font-size: 0.7rem;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.mini-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: #f9fafb;
  margin-top: 0.35rem;
}

.mini-sub {
  font-size: 0.7rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

/* Upload Area */
.upload-area {
  border: 2px dashed rgba(79, 70, 229, 0.4);
  border-radius: 0.75rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(15, 23, 42, 0.4);
}

.upload-area:hover {
  border-color: rgba(79, 70, 229, 0.7);
  background: rgba(79, 70, 229, 0.1);
}

.upload-area .bi {
  font-size: 3rem;
  color: #a5b4fc;
  margin-bottom: 1rem;
}

.upload-text {
  font-size: 0.9rem;
  color: #e5e7eb;
  font-weight: 500;
}

.upload-sub {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.5rem;
}

/* Document List */
.doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 200px;
  overflow-y: auto;
}

.doc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(55, 65, 81, 0.4);
  border-radius: 0.5rem;
  font-size: 0.8rem;
}

.doc-item-name {
  flex: 1;
  color: #e5e7eb;
}

.doc-item-status {
  padding: 0.2rem 0.5rem;
  border-radius: 0.3rem;
  font-size: 0.7rem;
  margin-left: 0.5rem;
}

.doc-item-status.pending { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.doc-item-status.processing { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.doc-item-status.completed { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.doc-item-status.failed { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.doc-item-delete {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.doc-item-delete:hover {
  color: #dc2626;
}

/* Prompt List */
.prompt-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 150px;
  overflow-y: auto;
}

.prompt-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.75rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(55, 65, 81, 0.4);
  border-radius: 0.5rem;
  font-size: 0.75rem;
}

.prompt-item-content {
  flex: 1;
  color: #e5e7eb;
}

.prompt-item-id {
  font-weight: 600;
  color: #a5b4fc;
  margin-bottom: 0.25rem;
}

.prompt-item-text {
  color: #9ca3af;
}

.prompt-item-delete {
  background: none;
  border: none;
  color: #ef4444;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 0.9rem;
}

/* Buttons */
.btn-glass {
  background: rgba(79, 70, 229, 0.2);
  border: 1px solid rgba(79, 70, 229, 0.5);
  color: #a5b4fc;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-glass:hover {
  background: rgba(79, 70, 229, 0.3);
  border-color: rgba(79, 70, 229, 0.7);
}

.btn-glass.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}

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

/* Inputs */
.input-glass {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(55, 65, 81, 0.6);
  border-radius: 0.5rem;
  padding: 0.65rem;
  color: #e5e7eb;
  font-size: 0.85rem;
  font-family: inherit;
  transition: all 0.2s;
}

.input-glass:focus {
  outline: none;
  border-color: rgba(79, 70, 229, 0.7);
  background: rgba(15, 23, 42, 0.8);
}

.input-glass::placeholder {
  color: #6b7280;
}

.select-glass {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(55, 65, 81, 0.6);
  border-radius: 0.5rem;
  padding: 0.4rem 0.8rem;
  color: #e5e7eb;
  font-size: 0.8rem;
  cursor: pointer;
}

.select-glass:focus {
  outline: none;
  border-color: rgba(79, 70, 229, 0.7);
}

/* Mobile Preview */
.preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.phone-frame {
  width: 375px;
  height: 667px;
  background: #1a1a1a;
  border-radius: 40px;
  padding: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  position: relative;
}

.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 30px;
  background: #1a1a1a;
  border-radius: 0 0 20px 20px;
  z-index: 10;
}

.phone-screen {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #f5f7fa 0%, #c3cfe2 100%);
  border-radius: 32px;
  overflow: hidden;
  position: relative;
}

.screen-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 50px 20px 20px;
  text-align: center;
}

.screen-header h3 {
  font-size: 1.2rem;
  margin: 0;
}

.screen-content {
  padding: 30px 20px;
  text-align: center;
}

.screen-content p {
  margin-bottom: 20px;
  color: #555;
}

.screen-btn {
  display: block;
  width: 100%;
  padding: 15px;
  margin: 10px 0;
  background: white;
  border: 2px solid #667eea;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #667eea;
  cursor: pointer;
  transition: all 0.3s;
}

.screen-btn:hover {
  background: #667eea;
  color: white;
}

/* AI Orb */
.ai-orb {
  position: absolute;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s;
  z-index: 100;
}

.ai-orb.idle {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.ai-orb.listening {
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  animation: pulse 1.5s infinite;
}

.ai-orb.thinking {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  animation: rotate 2s linear infinite;
}

.ai-orb.speaking {
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  animation: pulse 1s infinite;
}

.orb-inner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
}

.orb-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: inherit;
  opacity: 0.5;
  animation: pulse-ring 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes rotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.4); opacity: 0; }
}

/* Chat Dialog */
.chat-dialog {
  position: absolute;
  bottom: 100px;
  right: 20px;
  width: calc(100% - 40px);
  height: 400px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  z-index: 99;
  transition: all 0.3s;
}

.chat-dialog.hidden {
  display: none;
}

.chat-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 15px;
  border-radius: 20px 20px 0 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.chat-header button {
  background: none;
  border: none;
  color: white;
  font-size: 20px;
  cursor: pointer;
}

.chat-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
}

.message {
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  max-width: 80%;
  word-wrap: break-word;
}

.message.user {
  background: #667eea;
  color: white;
  margin-left: auto;
  text-align: right;
}

.message.assistant {
  background: #f0f0f0;
  color: #333;
}

.chat-input-area {
  display: flex;
  padding: 10px;
  border-top: 1px solid #e0e0e0;
}

.chat-input-area input {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 20px;
  padding: 10px 15px;
  font-size: 14px;
}

.chat-input-area button {
  margin-left: 8px;
  padding: 10px 20px;
  background: #667eea;
  color: white;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
}

.preview-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* Status Messages */
.status-message {
  padding: 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.status-message.success {
  background: rgba(34, 197, 94, 0.2);
  border: 1px solid rgba(34, 197, 94, 0.4);
  color: #22c55e;
}

.status-message.error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

.status-message.info {
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #3b82f6;
}

/* Action Alert */
.action-alert {
  position: fixed;
  top: 20px;
  right: 20px;
  background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 0.75rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  font-weight: 600;
  font-size: 0.9rem;
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.action-alert .bi {
  font-size: 1.2rem;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 1200px) {
  .phone-frame {
    transform: scale(0.8);
  }
}

@media (max-width: 992px) {
  .sidebar {
    display: none;
  }
  
  :root {
    --sidebar-width: 0;
  }
}
