/* Lwt's Store - Styles */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --success: #16a34a;
  --danger: #dc2626;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text: #1e293b;
  --text-secondary: #64748b;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 40px;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
}

/* Upload Section */
.upload-section {
  margin-bottom: 40px;
}

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 40px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: var(--card-bg);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.upload-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.upload-area p {
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 0.85rem;
  color: var(--text-secondary);
  opacity: 0.7;
}

/* Upload Progress */
.upload-progress {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-top: 16px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.file-name {
  font-weight: 600;
  font-size: 0.95rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.progress-text {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 4px;
  transition: width 0.3s ease;
  width: 0%;
}

.progress-details {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.upload-status {
  font-weight: 500;
}

/* Upload Complete */
.upload-complete {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  box-shadow: var(--shadow);
  margin-top: 16px;
}

.success-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.upload-complete p {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--success);
}

.download-link-box {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.download-link-box input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--bg);
  color: var(--text);
  outline: none;
}

/* Buttons */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy {
  background: var(--primary);
  color: white;
}

.btn-copy:hover {
  background: var(--primary-hover);
}

.btn-new {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-new:hover {
  background: var(--border);
}

.btn-cancel {
  background: var(--danger);
  color: white;
  margin-top: 12px;
}

.btn-cancel:hover {
  opacity: 0.9;
}

.btn-download {
  background: var(--primary);
  color: white;
  padding: 6px 14px;
  font-size: 0.8rem;
  text-decoration: none;
  display: inline-block;
}

.btn-download:hover {
  background: var(--primary-hover);
}

.btn-copy-small {
  background: transparent;
  color: var(--primary);
  padding: 6px 10px;
  font-size: 0.8rem;
  border: 1px solid var(--primary);
}

.btn-copy-small:hover {
  background: #eff6ff;
}

/* File List Section */
.file-list-section {
  margin-bottom: 40px;
}

.file-list-section h2 {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--text);
}

.file-list {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.loading,
.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--text-secondary);
}

.file-table {
  width: 100%;
  border-collapse: collapse;
}

.file-table thead {
  background: var(--bg);
}

.file-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

.file-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.file-table tbody tr:last-child td {
  border-bottom: none;
}

.file-table tbody tr:hover {
  background: #f1f5f9;
}

.file-name-cell {
  font-weight: 500;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size-cell {
  color: var(--text-secondary);
  white-space: nowrap;
}

.file-date-cell {
  color: var(--text-secondary);
  white-space: nowrap;
}

.file-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

/* Footer */
footer {
  text-align: center;
  padding: 20px 0;
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s ease;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* File List Header with Search */
.file-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.file-list-header h2 {
  margin-bottom: 0;
}

.search-box input {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--card-bg);
  color: var(--text);
  outline: none;
  width: 220px;
  transition: border-color 0.2s ease;
}

.search-box input:focus {
  border-color: var(--primary);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 8px;
}

.pagination-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.pagination-info select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--card-bg);
  color: var(--text);
  cursor: pointer;
  outline: none;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-page {
  padding: 6px 12px;
  font-size: 0.8rem;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-page:hover:not(:disabled) {
  background: var(--bg);
}

.btn-page:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-page-num {
  padding: 4px 10px;
  font-size: 0.8rem;
  background: var(--card-bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  min-width: 32px;
}

.btn-page-num:hover {
  background: var(--bg);
}

.btn-page-num.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Admin link */
.admin-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
}

.admin-link:hover {
  color: var(--primary);
}

/* Admin Page Styles */
.admin-login {
  max-width: 400px;
  margin: 0 auto;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  text-align: center;
}

.admin-login h2 {
  margin-bottom: 20px;
  color: var(--text);
}

.admin-login input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  margin-bottom: 12px;
  outline: none;
}

.admin-login input:focus {
  border-color: var(--primary);
}

.admin-login .btn {
  width: 100%;
}

.admin-login .error-msg {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 8px;
}

.btn-delete {
  background: var(--danger);
  color: white;
  padding: 6px 14px;
  font-size: 0.8rem;
}

.btn-delete:hover {
  opacity: 0.9;
}

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

.modal {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 420px;
  width: 90%;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal h3 {
  margin-bottom: 12px;
  color: var(--text);
}

.modal p {
  margin-bottom: 8px;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.modal-warning {
  color: var(--danger);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-actions .btn {
  min-width: 100px;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 20px 16px;
  }

  header h1 {
    font-size: 1.8rem;
  }

  .upload-area {
    padding: 40px 20px;
  }

  .file-table th:nth-child(3),
  .file-table td:nth-child(3) {
    display: none;
  }

  .download-link-box {
    flex-direction: column;
  }

  .file-actions {
    flex-direction: column;
  }

  .file-list-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .search-box input {
    width: 100%;
  }

  .pagination {
    flex-direction: column;
    align-items: flex-start;
  }
}
