/* ===== TODO-PRO 7: PREMIUM UI/UX DESIGN ===== */
/* Modern Aesthetic, Glassmorphism, Micro-interactions */

:root {
  /* Color Palette - Premium Indigo & Violet */
  --primary: #6366f1;
  /* Indigo 500 */
  --primary-hover: #4f46e5;
  /* Indigo 600 */
  --primary-light: #e0e7ff;
  /* Indigo 100 */

  --secondary: #8b5cf6;
  /* Violet 500 */
  --secondary-hover: #7c3aed;
  /* Violet 600 */

  --accent: #f43f5e;
  /* Rose 500 */

  /* Neutral Palette - Slate/Zinc */
  --bg-body: #f8fafc;
  /* Slate 50 */
  --bg-card: #ffffff;
  --bg-glass: rgba(255, 255, 255, 0.8);

  --text-main: #0f172a;
  /* Slate 900 */
  --text-muted: #64748b;
  /* Slate 500 */
  --text-light: #94a3b8;
  /* Slate 400 */

  --border-light: #e2e8f0;
  /* Slate 200 */
  --border-hover: #cbd5e1;
  /* Slate 300 */

  /* Semantic Colors */
  --success: #10b981;
  /* Emerald 500 */
  --warning: #f59e0b;
  /* Amber 500 */
  --error: #ef4444;
  /* Red 500 */
  --info: #3b82f6;
  /* Blue 500 */

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;

  /* Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --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-inner: inset 0 2px 4px 0 rgb(0 0 0 / 0.05);

  /* Z-Index */
  --z-sticky: 100;
  --z-modal: 1000;
  --z-toast: 2000;
}

/* Global Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
}

img {
  max-width: 100%;
  display: block;
}

/* Utility Layouts */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Auth Pages (Login / Admin) */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
  padding: var(--space-4);
}

.auth-container {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: var(--bg-card);
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--white);
}

.auth-header {
  text-align: center;
  margin-bottom: var(--space-8);
}

.logo-icon {
  font-size: 3rem;
  margin-bottom: var(--space-2);
  text-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

.auth-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.025em;
}

.auth-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Forms */
.form-group {
  margin-bottom: var(--space-4);
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: var(--space-2);
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: var(--bg-body);
  font-size: 1rem;
  color: var(--text-main);
  transition: all 0.2s ease;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
  background: var(--bg-card);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  line-height: 1;
}

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

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(99, 102, 241, 0.35);
}

.btn-secondary {
  background: var(--white);
  color: var(--text-main);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-body);
  border-color: var(--border-hover);
}

.btn-danger {
  background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
}

/* Dashboard Header */
.dashboard-header {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  border-bottom: 1px solid rgba(226, 232, 240, 0.6);
  padding: var(--space-4) 0;
}

/* Telegram Help & Setup */
.telegram-help {
  margin-top: var(--space-6);
  padding: var(--space-4);
  background: var(--bg-body);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
}

.telegram-help h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: var(--space-3);
  color: var(--text-main);
}

.telegram-help ol {
  padding-left: var(--space-6);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.telegram-help ol li {
  margin-bottom: var(--space-2);
}

.telegram-help .test-message {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px dashed var(--border-light);
}

.telegram-help .test-text {
  margin-top: var(--space-2);
  padding: var(--space-3);
  background: var(--white);
  border-radius: var(--radius-md);
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--primary);
  border: 1px solid var(--primary-light);
}


.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.header-actions {
  display: flex;
  gap: var(--space-3);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* Main Content Area */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}

/* Search & Filter Section */
.search-filter-section {
  max-width: 800px;
  margin: 0 auto var(--space-6);
}

.search-filter-container {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.search-box {
  flex: 1;
  position: relative;
  min-width: 280px;
}

.search-box input {
  padding-left: 2.75rem;
}

.search-box i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
}

.filter-options {
  display: flex;
  gap: var(--space-2);
}

/* Create Todo Card */
.create-todo-section {
  max-width: 800px;
  margin: 0 auto var(--space-8);
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-xl);
}

.card-header {
  padding: var(--space-4) var(--space-6);
  background: var(--bg-body);
  border-bottom: 1px solid var(--border-light);
}

.card-header h2 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-body {
  padding: var(--space-6);
}

/* File Upload Area - Enhanced */
.file-upload-area {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
  transition: all 0.2s ease;
  background: var(--bg-body);
  cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 8px;
}

.upload-row {
  aspect-ratio: 1;
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: var(--bg-body);
  transition: all 0.2s ease;
  overflow: hidden;
  position: relative;
}

.upload-row:hover {
  border-color: var(--primary);
  background: var(--white);
}

.upload-row.has-file {
  border-style: solid;
  background: var(--white);
}

.upload-content {
  text-align: center;
  width: 100%;
  padding: 8px;
}

.file-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
}

.remove-file {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 14px;
  z-index: 10;
}

.file-info {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
  word-break: break-all;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Todo List */
.todos-header {
  max-width: 800px;
  margin: 0 auto var(--space-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.todos-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.todo-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-6);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  transition: all 0.2s ease;
}

.todo-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.todo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.todo-text {
  font-size: 1rem;
  color: var(--text-main);
  white-space: pre-wrap;
  line-height: 1.5;
}

.todo-actions .action-btn {
  background: transparent;
  border: none;
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.todo-actions .delete-btn:hover {
  background: #fee2e2;
  color: var(--error);
}

.todo-meta {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: var(--space-1);
}

.todo-attachments {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-light);
}

.attachments-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-body);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background-color: rgba(15, 23, 42, 0.6);
  z-index: var(--z-modal);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.3s ease;
}

.modal-content {
  background-color: var(--bg-card);
  margin: 0 auto;
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  width: 90%;
  max-width: 550px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: scaleIn 0.3s ease;
  overflow: hidden;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-body);
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  cursor: pointer;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--error);
}

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  gap: var(--space-1);
  background: var(--bg-body);
  padding: var(--space-1);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
}

.tab-btn {
  flex: 1;
  padding: var(--space-2) var(--space-4);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s;
}

.tab-content.active {
  display: block;
}

/* Alerts */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-sm);
}

.alert-error {
  background: #fef2f2;
  color: var(--error);
  border: 1px solid #fecaca;
}

.alert-success {
  background: #ecfdf5;
  color: var(--success);
  border: 1px solid #a7f3d0;
}

/* Global Alert Container (Toast) */
.alert-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 350px;
  width: 100%;
  pointer-events: none;
}

.alert-container>.alert {
  pointer-events: auto;
  margin-bottom: 0;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-lg);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.alert button {
  margin-left: auto;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 4px;
}

.alert button:hover {
  opacity: 1;
}

/* Pagination */
.pagination-container {
  max-width: 800px;
  margin: var(--space-8) auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-light);
}

.page-numbers {
  display: flex;
  gap: var(--space-1);
}

/* Loading Overlay */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(4px);
  z-index: 2000;
}

.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--primary);
}

.fa-spin {
  font-size: 2rem;
  margin-bottom: var(--space-2);
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: var(--space-4);
  }

  .search-filter-container {
    flex-direction: column;
  }

  .auth-card {
    padding: var(--space-6);
  }
}