/* KSC FileShare - Modern UI */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: #e0e7ff;
  --secondary: #0ea5e9;
  --accent: #8b5cf6;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #f59e0b;
  --danger: #ef4444;
  --danger-light: #fee2e2;

  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
  --gradient-3: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
  color: var(--gray-100);
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-container {
  max-width: 1280px;
}

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding: 1rem 0;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.025em;
}

header nav {
  display: flex;
  gap: 0.5rem;
}

header nav a {
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

header nav a:hover,
header nav a.active {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

/* Main Content */
main {
  flex: 1;
}

/* Upload Section */
.upload-section {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.5rem;
  padding: 2.5rem;
  box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
  padding: 4rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(255, 255, 255, 0.02);
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-2);
  opacity: 0;
  transition: opacity 0.3s;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  transform: translateY(-2px);
}

.dropzone:hover::before,
.dropzone.dragover::before {
  opacity: 0.05;
}

.dropzone-content {
  position: relative;
  z-index: 1;
}

.dropzone .icon {
  width: 4rem;
  height: 4rem;
  color: var(--primary);
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.5));
}

.dropzone p {
  color: var(--gray-300);
  font-size: 1.125rem;
  font-weight: 500;
}

.dropzone .sub {
  color: var(--gray-500);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.dropzone .limit-info {
  color: var(--gray-500);
  font-size: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* File List */
.file-list {
  margin-top: 1.5rem;
}

.file-item {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  transition: all 0.2s;
}

.file-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.file-item.completed {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.file-item.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
}

.file-item-icon {
  width: 2.5rem;
  height: 2.5rem;
  background: var(--gradient-3);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 1rem;
  flex-shrink: 0;
}

.file-item-icon svg {
  width: 1.25rem;
  height: 1.25rem;
  color: white;
}

.file-item-info {
  flex: 1;
  min-width: 0;
}

.file-item-name {
  display: block;
  font-weight: 500;
  color: var(--gray-100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-size {
  font-size: 0.75rem;
  color: var(--gray-500);
}

.file-item-progress {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 1rem;
}

.progress-bar {
  flex: 1;
  height: 0.375rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--gradient-2);
  border-radius: 9999px;
  transition: width 0.3s ease-out;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.progress-text {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  min-width: 3rem;
  text-align: right;
}

.file-item-remove {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--gray-500);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 0.375rem;
  transition: all 0.2s;
  line-height: 1;
}

.file-item-remove:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

/* Options */
.options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.option-group label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-400);
  margin-bottom: 0.5rem;
}

.option-group input,
.option-group select {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-100);
  transition: all 0.2s;
}

.option-group input::placeholder {
  color: var(--gray-500);
}

.option-group input:focus,
.option-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.option-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.option-group select option {
  background: var(--gray-800);
  color: var(--gray-100);
}

/* Buttons */
.btn-upload {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  margin-top: 2rem;
  background: var(--gradient-2);
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.btn-upload::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(rgba(255, 255, 255, 0.1), transparent);
}

.btn-upload:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
}

.btn-upload:active:not(:disabled) {
  transform: translateY(0);
}

.btn-upload:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Result Section */
.result-section {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 1.5rem;
  padding: 2rem;
  margin-top: 1.5rem;
  box-shadow: var(--shadow-xl);
}

.result-section h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-section h2::before {
  content: '✓';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  background: var(--success);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
}

.result-item {
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  margin-bottom: 1rem;
}

.result-info {
  margin-bottom: 1rem;
}

.result-name {
  display: block;
  font-weight: 600;
  color: var(--gray-100);
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.result-size,
.result-expires {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-right: 1.5rem;
}

.result-url {
  display: flex;
  gap: 0.5rem;
}

.result-url input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.5rem;
  font-size: 0.8rem;
  color: var(--gray-300);
  font-family: 'Monaco', 'Menlo', monospace;
}

.result-url button {
  padding: 0.75rem 1.25rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.result-url button:hover {
  background: var(--primary-hover);
}

/* Download Section */
.download-section {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1.5rem;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.loading {
  padding: 3rem;
}

.spinner {
  width: 3rem;
  height: 3rem;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1.5rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.file-info .file-icon {
  margin-bottom: 2rem;
}

.file-info .file-icon svg {
  width: 5rem;
  height: 5rem;
  color: var(--primary);
  filter: drop-shadow(0 0 30px rgba(99, 102, 241, 0.5));
}

.file-info h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  word-break: break-all;
  color: var(--gray-100);
}

.file-size,
.file-expires {
  font-size: 0.875rem;
  color: var(--gray-400);
  margin-bottom: 0.5rem;
}

.password-form {
  max-width: 320px;
  margin: 2rem auto;
  text-align: left;
}

.password-form label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--gray-400);
  margin-bottom: 0.5rem;
}

.password-form input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--gray-100);
}

.password-form input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.password-form .error {
  color: var(--danger);
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2.5rem;
  margin-top: 2rem;
  background: var(--gradient-2);
  color: white;
  border: none;
  border-radius: 0.75rem;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-download:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
}

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

.error-section {
  padding: 3rem;
}

.error-icon {
  width: 5rem;
  height: 5rem;
  color: var(--danger);
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 20px rgba(239, 68, 68, 0.5));
}

.error-section h2 {
  color: var(--danger);
  margin-bottom: 0.5rem;
}

.error-section p {
  color: var(--gray-400);
}

/* Admin Styles */
.stats-section {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.stats-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--gray-300);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.stat-card {
  text-align: center;
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.75rem;
  transition: all 0.2s;
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}

.stat-value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient-2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.actions {
  margin-top: 1rem;
  text-align: right;
}

.btn-secondary {
  padding: 0.625rem 1.25rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--gray-300);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
}

/* Files Table */
.files-section {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
}

.files-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--gray-300);
}

.table-wrapper {
  overflow-x: auto;
}

.files-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.files-table th,
.files-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.files-table th {
  font-weight: 500;
  color: var(--gray-500);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.files-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.files-table tr.expired td {
  opacity: 0.5;
}

.file-name {
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--gray-200);
}

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--warning);
  color: var(--gray-900);
  font-size: 0.625rem;
  font-weight: 600;
  border-radius: 9999px;
  margin-left: 0.5rem;
  text-transform: uppercase;
}

.expired-text {
  color: var(--danger);
}

.loading-row,
.empty-row,
.error-row {
  text-align: center;
  color: var(--gray-500);
  padding: 2rem !important;
}

.actions-cell {
  white-space: nowrap;
}

.btn-small {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--gray-300);
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  margin-right: 0.375rem;
  transition: all 0.2s;
}

.btn-small:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.btn-small.btn-danger {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

.btn-small.btn-danger:hover {
  background: var(--danger);
  color: white;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.375rem;
  margin-top: 1.5rem;
}

.page-btn {
  padding: 0.5rem 0.875rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.375rem;
  color: var(--gray-400);
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

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

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal[hidden] {
  display: none !important;
}

.modal-content {
  background: var(--gray-900);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 1rem;
  width: 90%;
  max-width: 800px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--gray-200);
}

.modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  font-size: 1.25rem;
  color: var(--gray-400);
  cursor: pointer;
  line-height: 1;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.logs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
}

.logs-table th,
.logs-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--gray-400);
}

.logs-table th {
  color: var(--gray-500);
  font-weight: 500;
}

.ua-cell {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Footer */
footer {
  margin-top: 3rem;
  text-align: center;
  color: var(--gray-600);
  font-size: 0.75rem;
  padding: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 1rem;
  }

  .upload-section {
    padding: 1.5rem;
  }

  .dropzone {
    padding: 2.5rem 1.5rem;
  }

  .options {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .file-name {
    max-width: 120px;
  }

  header h1 {
    font-size: 1.25rem;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}
