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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: linear-gradient(135deg, #0b1220 0%, #1a2a3a 100%);
  color: #e8eefc;
  min-height: 100vh;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #0b1220 0%, #1a2a3a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 20px;
}

.login-card {
  background: #0f172a;
  border: 1px solid #22304f;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

.login-title {
  text-align: center;
  font-size: 28px;
  margin-bottom: 8px;
  color: #3b82f6;
}

.login-subtitle {
  text-align: center;
  color: #a0aec0;
  margin-bottom: 32px;
  font-size: 14px;
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  color: #e8eefc;
  font-weight: 500;
  font-size: 14px;
}

.form-group input {
  padding: 12px;
  background: #1a2a3a;
  border: 1px solid #22304f;
  border-radius: 8px;
  color: #e8eefc;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-group input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-btn {
  padding: 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.login-btn:active {
  transform: translateY(0);
}

.login-error {
  color: #f87171;
  font-size: 14px;
  text-align: center;
  min-height: 20px;
}

/* ===== MAIN APP CONTAINER ===== */
.main-app {
  display: block;
}

/* ===== END LOGIN PAGE STYLES ===== */

/* Navbar */
.navbar {
  background: #0f172a;
  border-bottom: 1px solid #22304f;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.nav-wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-brand {
  font-size: 18px;
  font-weight: 700;
  color: #3b82f6;
}

.nav-items {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-btn {
  padding: 10px 14px;
  background: transparent;
  border: 1px solid #2a3a60;
  color: #a0aec0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.nav-btn:hover {
  background: #1a2a3a;
  color: #93c5fd;
  border-color: #365186;
  transform: translateY(-1px);
}

.nav-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-color: #3b82f6;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.25);
}

.nav-icon {
  font-size: 15px;
  line-height: 1;
}

.logout-btn {
  background: #dc2626 !important;
  color: white !important;
  border-color: #991b1b !important;
  margin-left: auto;
}

.logout-btn:hover {
  background: #b91c1c !important;
  border-color: #7f1d1d !important;
}

/* ===== HOME PAGE CARDS ===== */
.hero-section {
  text-align: center;
  padding: 40px 20px;
  margin-bottom: 40px;
}

.hero-title {
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 16px;
}

.hero-subtitle {
  font-size: 20px;
  color: #a0aec0;
  font-weight: 400;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 20px;
}

.feature-card {
  background: linear-gradient(135deg, #0f172a 0%, #1a2035 100%);
  border: 1px solid #22304f;
  border-radius: 16px;
  padding: 32px 24px;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feature-card:hover::before {
  opacity: 1;
}

.feature-card:hover {
  transform: translateY(-8px);
  border-color: #3b82f6;
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.2);
}

.card-icon {
  font-size: 48px;
  margin-bottom: 16px;
  text-align: center;
}

.card-title {
  font-size: 24px;
  font-weight: 700;
  color: #e8eefc;
  margin-bottom: 12px;
  text-align: center;
}

.card-description {
  font-size: 14px;
  color: #a0aec0;
  line-height: 1.6;
  margin-bottom: 20px;
  text-align: center;
}

.card-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  justify-content: center;
}

.feature-tag {
  background: #1a2a3a;
  border: 1px solid #2a3a60;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  color: #3b82f6;
  font-weight: 500;
}

.card-btn {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
}

.card-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.stats-section {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 20px;
}

.stat-card {
  background: #0f172a;
  border: 1px solid #22304f;
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  transition: all 0.3s ease;
}

.stat-card:hover {
  border-color: #3b82f6;
  transform: translateY(-4px);
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #3b82f6;
  margin-bottom: 8px;
}

.stat-label {
  font-size: 14px;
  color: #a0aec0;
  font-weight: 500;
}

/* ===== END HOME PAGE CARDS ===== */

/* Container */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

.wrapper {
  max-width: 760px;
  margin: 0 auto;
}

.page {
  animation: fadeIn 0.3s;
}

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

/* Cards */
.card {
  background: #121b2e;
  border: 1px solid #22304f;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.card h3 {
  margin-bottom: 16px;
  color: #3b82f6;
  font-size: 16px;
}

.card.info {
  background: rgba(59, 130, 246, 0.1);
  border-color: #3b82f6;
}

.card.info p {
  margin: 8px 0;
  font-size: 14px;
}

/* Typography */
h1 {
  font-size: 32px;
  margin-bottom: 20px;
  color: #e8eefc;
}

.page-title {
  margin-bottom: 8px;
}

.page-subtitle {
  margin-bottom: 18px;
  color: #9aa8bf;
  font-size: 14px;
}

h2 {
  font-size: 24px;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 14px;
  color: #cbd5e0;
  margin-bottom: 6px;
  font-weight: 500;
}

.hint {
  font-size: 12px;
  color: #a0aec0;
  margin-top: 6px;
}

.hint a {
  color: #3b82f6;
  text-decoration: none;
}

.hint a:hover {
  text-decoration: underline;
}

/* Form Elements */
input, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #2a3a60;
  background: #0f172a;
  color: #e8eefc;
  margin-bottom: 12px;
  font-size: 14px;
  transition: all 0.2s;
}

input:focus, select:focus {
  outline: none;
  border-color: #3b82f6;
  background: #1a2a3a;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  cursor: pointer;
}

input[type="color"] {
  padding: 4px;
  height: 40px;
}

.input-group {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.input-group input {
  flex: 1;
  margin-bottom: 0;
}

.btn-sm {
  padding: 10px 12px;
  background: #2a3a60;
  border: 1px solid #3a4a70;
  color: #a0aec0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.btn-sm:hover {
  background: #3a4a70;
  color: #e8eefc;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
  margin-bottom: 8px;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-primary:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: #6b7280;
  color: white;
}

.btn-secondary:hover {
  background: #4b5563;
}

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

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

.row {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.row > div {
  flex: 1;
}

.row label {
  display: flex;
  align-items: flex-start;
  width: 100%;
}

.concept-note {
  margin: 6px 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #2f456f;
  background: rgba(59, 130, 246, 0.08);
  color: #c8d8f7;
  font-size: 13px;
}

/* Quality Grid */
.quality-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.quality-card {
  background: #1e2942;
  border: 2px solid #2a3a60;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.quality-card:hover {
  border-color: #3b82f6;
  background: #253d5f;
}

.quality-card.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #3b82f6;
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.quality-icon {
  font-size: 24px;
}

.quality-name {
  font-weight: 600;
  font-size: 13px;
  color: #e8eefc;
}

.quality-card.active .quality-name {
  color: white;
}

.quality-desc {
  font-size: 11px;
  color: #a0aec0;
}

.quality-card.active .quality-desc {
  color: #dbeafe;
}

/* Concept Grid */
.concept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.concept-card {
  background: #1e2942;
  border: 2px solid #2a3a60;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.concept-card:hover {
  border-color: #3b82f6;
  background: #253d5f;
  transform: translateY(-2px);
}

.concept-card.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #3b82f6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.concept-aspect {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 10px;
  background: rgba(0, 0, 0, 0.3);
  padding: 2px 6px;
  border-radius: 4px;
  color: #a0aec0;
}

.concept-card.active .concept-aspect {
  color: #dbeafe;
  background: rgba(0, 0, 0, 0.5);
}

.concept-icon {
  font-size: 28px;
  margin-top: 4px;
}

.concept-name {
  font-weight: 600;
  font-size: 12px;
  color: #e8eefc;
}

.concept-card.active .concept-name {
  color: white;
}

.concept-desc {
  font-size: 10px;
  color: #a0aec0;
}

.concept-card.active .concept-desc {
  color: #dbeafe;
}

/* Clip Count Selector */
.clip-count-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.count-btn {
  flex: 1;
  min-width: 50px;
  padding: 10px;
  background: #1e2942;
  border: 2px solid #2a3a60;
  color: #e8eefc;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
}

.count-btn:hover {
  border-color: #3b82f6;
  background: #253d5f;
}

.count-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  border-color: #3b82f6;
  color: white;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Status Messages */
.status-box {
  background: #0f172a;
  border: 1px solid #2a3a60;
  padding: 12px;
  border-radius: 8px;
  margin-top: 12px;
  min-height: 60px;
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: 'Courier New', monospace;
  max-height: 300px;
  overflow-y: auto;
}

.status-msg {
  font-size: 12px;
  margin-top: 8px;
  padding: 8px;
  border-radius: 6px;
  min-height: 20px;
}

.status-msg.success {
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
  border: 1px solid #22c55e;
}

.status-msg.error {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
  border: 1px solid #ef4444;
}

.status-msg.loading {
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
  border: 1px solid #3b82f6;
}

/* Files Grid */
.files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.file-card {
  background: #121b2e;
  border: 1px solid #22304f;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  flex-direction: column;
}

.file-card:hover {
  border-color: #3b82f6;
  transform: translateY(-4px);
  box-shadow: 0 8px 16px rgba(59, 130, 246, 0.2);
}

.file-thumb {
  width: 100%;
  height: 120px;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: #2a3a60;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.file-name {
  font-size: 13px;
  font-weight: 600;
  color: #e8eefc;
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  font-size: 11px;
  color: #a0aec0;
}

.file-actions {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  background: #0f172a;
  border-top: 1px solid #22304f;
  justify-content: space-between;
}

.action-btn {
  flex: 1;
  padding: 8px 6px;
  background: #1e2942;
  border: 1px solid #2a3a60;
  color: #e8eefc;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.action-btn:hover {
  background: #2a4060;
  border-color: #3b82f6;
}

.action-btn.delete:hover {
  background: #7f1d1d;
  border-color: #ef4444;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #6b7280;
}

.empty-state p {
  font-size: 18px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.3s;
}

.modal-content {
  background: #121b2e;
  border: 1px solid #22304f;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-content.modal-lg {
  max-width: 900px;
}

.close {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  color: #a0aec0;
  transition: color 0.2s;
}

.close:hover {
  color: #e8eefc;
}

/* Subtitle Editor */
.subtitle-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.subtitle-preview {
  border: 1px solid #22304f;
  border-radius: 8px;
  overflow: hidden;
}

.subtitle-list {
  border: 1px solid #22304f;
  border-radius: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.subtitle-item {
  padding: 12px;
  border-bottom: 1px solid #22304f;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 12px;
}

.subtitle-item:hover {
  background: #1a2a3a;
}

.subtitle-item.active {
  background: rgba(59, 130, 246, 0.2);
  border-left: 3px solid #3b82f6;
}

.subtitle-time {
  color: #a0aec0;
  font-size: 11px;
  margin-bottom: 4px;
}

.subtitle-text {
  color: #e8eefc;
}

/* Responsive */
@media (max-width: 768px) {
  .nav-items {
    gap: 4px;
  }

  .nav-btn {
    padding: 6px 12px;
    font-size: 12px;
  }

  .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .subtitle-editor {
    grid-template-columns: 1fr;
  }

  .modal-content {
    max-width: 95%;
    padding: 16px;
  }

  .row {
    flex-direction: column;
  }

  .row > div {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  h1 {
    font-size: 24px;
  }

  .card {
    padding: 16px;
  }

  .files-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
  }
}
