/**
 * Twilight Theme - สีโทนม่วงน้ำเงิน แบบท้องฟ้ายามค่ำคืน
 */

:root {
  /* สีหลัก Twilight */
  --twilight-bg-dark: #0d0d1a;
  --twilight-bg: #1a1a2e;
  --twilight-bg-light: #16213e;
  --twilight-accent: #6c5ce7;
  --twilight-accent-light: #a29bfe;
  --twilight-highlight: #e056fd;
  --twilight-cyan: #00d9ff;
  
  /* สีข้อความ */
  --twilight-text: #e8e8e8;
  --twilight-text-muted: #a0a0b8;
  --twilight-text-dim: #6b6b8a;
  
  /* สีขอบและเงา */
  --twilight-border: rgba(108, 92, 231, 0.3);
  --twilight-glow: rgba(108, 92, 231, 0.4);
  --twilight-shadow: rgba(0, 0, 0, 0.5);
  
  /* Gradients */
  --twilight-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  --twilight-gradient-accent: linear-gradient(135deg, #6c5ce7 0%, #a29bfe 50%, #e056fd 100%);
}

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

body {
  font-family: 'Segoe UI', 'Nunito', system-ui, sans-serif;
  background: var(--twilight-gradient);
  color: var(--twilight-text);
  min-height: 100vh;
  line-height: 1.6;
}

/* Background effects */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(108, 92, 231, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(224, 86, 253, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0, 217, 255, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Container */
.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.container-wide {
  max-width: 900px;
  margin: 0 auto;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

/* Card / Panel */
.card {
  background: rgba(26, 26, 46, 0.8);
  border: 1px solid var(--twilight-border);
  border-radius: 16px;
  padding: 2rem;
  backdrop-filter: blur(12px);
  box-shadow: 
    0 8px 32px var(--twilight-shadow),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.card-header {
  text-align: center;
  margin-bottom: 2rem;
}

.card-header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  background: var(--twilight-gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-header p {
  color: var(--twilight-text-muted);
  font-size: 0.9rem;
  margin-top: 0.5rem;
}

/* Form */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--twilight-text-muted);
}

.form-control {
  width: 100%;
  padding: 0.875rem 1rem;
  background: rgba(15, 15, 30, 0.6);
  border: 1px solid var(--twilight-border);
  border-radius: 10px;
  color: var(--twilight-text);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.form-control::placeholder {
  color: var(--twilight-text-dim);
}

.form-control:focus {
  outline: none;
  border-color: var(--twilight-accent);
  box-shadow: 0 0 0 3px var(--twilight-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  width: 100%;
  background: var(--twilight-gradient-accent);
  color: white;
  margin-top: 0.5rem;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--twilight-glow);
}

.btn-secondary {
  background: rgba(108, 92, 231, 0.2);
  color: var(--twilight-accent-light);
  border: 1px solid var(--twilight-border);
}

.btn-secondary:hover {
  background: rgba(108, 92, 231, 0.3);
}

.btn-danger {
  background: rgba(255, 82, 82, 0.2);
  color: #ff5252;
}

.btn-danger:hover {
  background: rgba(255, 82, 82, 0.3);
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;
}

.btn-group .btn-inline {
  display: inline-flex;
}

.btn-group .btn-inline button {
  margin: 0;
  white-space: nowrap;
}

.file-actions {
  min-width: 140px;
}

.file-actions .btn {
  flex-shrink: 0;
}

/* Alerts */
.alert {
  padding: 1rem 1.25rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-error {
  background: rgba(255, 82, 82, 0.15);
  border: 1px solid rgba(255, 82, 82, 0.3);
  color: #ff8a80;
}

.alert-success {
  background: rgba(0, 230, 118, 0.15);
  border: 1px solid rgba(0, 230, 118, 0.3);
  color: #69f0ae;
}

.alert-info {
  background: rgba(0, 217, 255, 0.1);
  border: 1px solid rgba(0, 217, 255, 0.3);
  color: var(--twilight-cyan);
}

/* Navbar */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(13, 13, 26, 0.9);
  border-bottom: 1px solid var(--twilight-border);
  backdrop-filter: blur(12px);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--twilight-accent-light);
  text-decoration: none;
}

.navbar-menu {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.navbar-menu a {
  color: var(--twilight-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.navbar-menu a:hover {
  color: var(--twilight-accent-light);
}

/* Table */
.table-wrapper {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid var(--twilight-border);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(26, 26, 46, 0.5);
}

th, td {
  padding: 1rem 1.25rem;
  text-align: left;
}

th {
  background: rgba(108, 92, 231, 0.15);
  color: var(--twilight-accent-light);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr {
  border-bottom: 1px solid var(--twilight-border);
}

tr:last-child {
  border-bottom: none;
}

tr:hover {
  background: rgba(108, 92, 231, 0.05);
}

/* File list / R2 */
.file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  background: rgba(15, 15, 30, 0.4);
  border-radius: 10px;
  margin-bottom: 0.5rem;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.file-item:hover {
  border-color: var(--twilight-border);
}

.file-link {
  color: var(--twilight-cyan);
  text-decoration: none;
  word-break: break-all;
}

.file-link:hover {
  text-decoration: underline;
}

/* Utilities */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }

/* Login page centering */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
