﻿/* 
 * VoteSondhan - Premium UI Styles
 * Scoped to .ds-votesondhan-page to avoid conflicts with main site
 */

.ds-votesondhan-page {
  --vs-bg: transparent; /* rely on main body bg */
  --vs-card-bg: rgba(22, 24, 29, 0.7);
  --vs-card-border: rgba(255, 255, 255, 0.08);
  --vs-card-hover-border: rgba(255, 255, 255, 0.15);
  --vs-primary: #3b82f6;
  --vs-primary-hover: #2563eb;
  --vs-success: #10b981;
  --vs-success-bg: rgba(16, 185, 129, 0.1);
  --vs-warning: #f59e0b;
  --vs-warning-bg: rgba(245, 158, 11, 0.1);
  --vs-danger: #ef4444;
  --vs-danger-bg: rgba(239, 68, 68, 0.1);
  --vs-text-main: #f8fafc;
  --vs-text-muted: #94a3b8;
  --vs-input-bg: rgba(15, 17, 21, 0.8);
  --vs-input-border: rgba(255, 255, 255, 0.1);
  --vs-input-focus: rgba(59, 130, 246, 0.5);
  --vs-table-header-bg: rgba(15, 17, 21, 0.95);
  --vs-table-row-border: rgba(255, 255, 255, 0.04);
  --vs-table-row-hover: rgba(255, 255, 255, 0.02);
  --vs-border-radius: 16px;
  --vs-border-radius-sm: 8px;
  --vs-transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  
  font-family: 'Inter', 'Noto Sans Bengali', sans-serif;
  color: var(--vs-text-main);
  padding-bottom: 60px;
}

/* Animations */
@keyframes vsFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes vsPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.ds-votesondhan-page .card {
  background: var(--vs-card-bg);
  border: 1px solid var(--vs-card-border);
  border-radius: var(--vs-border-radius);
  padding: 32px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  animation: vsFadeIn 0.4s ease-out forwards;
}

/* -------------------------------------
 * HERO & UPLOAD SECTION
 * ------------------------------------- */
.ds-votesondhan-page .hero {
  text-align: center;
  margin-bottom: 32px;
}

.ds-votesondhan-page .hero h2 {
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 700;
  margin: 0 0 12px;
  background: linear-gradient(135deg, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.ds-votesondhan-page .hero p {
  color: var(--vs-text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

.ds-votesondhan-page .dropzone {
  display: block;
  border: 2px dashed var(--vs-card-border);
  border-radius: var(--vs-border-radius);
  padding: 60px 20px;
  text-align: center;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
  transition: all var(--vs-transition);
}

.ds-votesondhan-page .dropzone:hover,
.ds-votesondhan-page .dropzone.active {
  border-color: var(--vs-primary);
  background: rgba(59, 130, 246, 0.05);
}

.ds-votesondhan-page .uploadIcon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  background: var(--vs-card-bg);
  border: 1px solid var(--vs-card-border);
  font-size: 24px;
  color: var(--vs-primary);
  transition: transform var(--vs-transition);
}

.ds-votesondhan-page .dropzone:hover .uploadIcon {
  transform: translateY(-5px);
  border-color: var(--vs-primary);
  box-shadow: 0 10px 20px rgba(59, 130, 246, 0.1);
}

.ds-votesondhan-page .dropzone h3 {
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 8px;
}

.ds-votesondhan-page .dropzone p {
  color: var(--vs-text-muted);
  margin: 0 0 16px;
  font-size: 0.95rem;
}

.ds-votesondhan-page .dropzone small {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--vs-success);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.ds-votesondhan-page .dropzone small::before {
  content: "🔒";
  font-size: 0.9rem;
}

/* Progress Bar */
.ds-votesondhan-page .progress {
  height: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  overflow: hidden;
  margin: 30px 0 15px;
}

.ds-votesondhan-page .progress div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--vs-primary), #60a5fa);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.ds-votesondhan-page .status {
  color: var(--vs-text-muted);
  text-align: center;
  font-size: 0.9rem;
  animation: vsPulse 2s infinite;
}

/* -------------------------------------
 * RESULTS & DASHBOARD SECTION
 * ------------------------------------- */
.ds-votesondhan-page .resultHead {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--vs-card-border);
}

.ds-votesondhan-page .resultTitle {
  min-width: 0;
  flex: 1;
}

.ds-votesondhan-page .resultTitle h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.ds-votesondhan-page .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: var(--vs-success);
  border-radius: 50%;
  box-shadow: 0 0 10px var(--vs-success);
  animation: vsPulse 2s infinite;
}

.ds-votesondhan-page #fileName {
  color: var(--vs-text-muted);
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
  display: inline-block;
  vertical-align: bottom;
}

/* Forms & Buttons */
.ds-votesondhan-page .btn,
.ds-votesondhan-page .danger,
.ds-votesondhan-page select,
.ds-votesondhan-page input {
  background: var(--vs-input-bg);
  color: var(--vs-text-main);
  border: 1px solid var(--vs-input-border);
  border-radius: var(--vs-border-radius-sm);
  padding: 10px 16px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all var(--vs-transition);
}

.ds-votesondhan-page .btn {
  font-weight: 500;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
}

.ds-votesondhan-page .btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--vs-card-hover-border);
}

.ds-votesondhan-page .danger {
  color: var(--vs-danger);
  background: var(--vs-danger-bg);
  border-color: transparent;
  font-weight: 600;
  cursor: pointer;
}

.ds-votesondhan-page .danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

.ds-votesondhan-page input:focus,
.ds-votesondhan-page select:focus {
  border-color: var(--vs-primary);
  box-shadow: 0 0 0 3px var(--vs-input-focus);
}

.ds-votesondhan-page select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Toolbar (Search & Filters) */
.ds-votesondhan-page .toolbar {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 180px 160px auto;
  gap: 16px;
  margin-bottom: 24px;
}

.ds-votesondhan-page .searchWrap {
  position: relative;
  display: flex;
  align-items: center;
}

.ds-votesondhan-page .searchIcon {
  position: absolute;
  left: 14px;
  color: var(--vs-text-muted);
  font-size: 18px;
  pointer-events: none;
}

.ds-votesondhan-page .searchWrap input {
  width: 100%;
  padding-left: 42px;
}

.ds-votesondhan-page .metaRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: var(--vs-text-muted);
}

.ds-votesondhan-page .metaRow b {
  color: var(--vs-text-main);
  font-weight: 600;
}

.ds-votesondhan-page #foundCount {
  color: var(--vs-primary);
}

/* -------------------------------------
 * DATA TABLE
 * ------------------------------------- */
.ds-votesondhan-page .tableWrap {
  overflow-x: auto;
  border: 1px solid var(--vs-card-border);
  border-radius: var(--vs-border-radius-sm);
  background: rgba(0, 0, 0, 0.2);
  /* Custom scrollbar for table */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}

.ds-votesondhan-page .tableWrap::-webkit-scrollbar {
  height: 8px;
}
.ds-votesondhan-page .tableWrap::-webkit-scrollbar-track {
  background: transparent;
}
.ds-votesondhan-page .tableWrap::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 10px;
}

.ds-votesondhan-page table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.ds-votesondhan-page th {
  background: var(--vs-table-header-bg);
  color: var(--vs-text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--vs-card-border);
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.ds-votesondhan-page td {
  padding: 16px;
  border-bottom: 1px solid var(--vs-table-row-border);
  font-size: 0.95rem;
  vertical-align: top;
  line-height: 1.5;
}

.ds-votesondhan-page tbody tr {
  transition: background var(--vs-transition);
}

.ds-votesondhan-page tbody tr:hover {
  background: var(--vs-table-row-hover);
}

.ds-votesondhan-page tbody tr:last-child td {
  border-bottom: none;
}

/* Table columns */
.ds-votesondhan-page .col-no { width: 70px; }
.ds-votesondhan-page .col-name { width: 180px; }
.ds-votesondhan-page .col-voter { width: 150px; }
.ds-votesondhan-page .col-parents { width: 180px; }
.ds-votesondhan-page .col-occupation { width: 110px; }
.ds-votesondhan-page .col-dob { width: 110px; }
.ds-votesondhan-page .col-address { width: auto; }
.ds-votesondhan-page .col-status { width: 100px; }

.ds-votesondhan-page td:first-child {
  color: var(--vs-text-muted);
  font-variant-numeric: tabular-nums;
}

.ds-votesondhan-page td b {
  color: var(--vs-text-main);
  font-weight: 600;
}

.ds-votesondhan-page .parent div {
  margin-bottom: 4px;
  color: var(--vs-text-muted);
  font-size: 0.9rem;
}
.ds-votesondhan-page .parent div:last-child {
  margin-bottom: 0;
}

/* Status Badges */
.ds-votesondhan-page .statusBadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ds-votesondhan-page .statusBadge[data-status="Active"],
.ds-votesondhan-page .statusBadge:not([data-status="Migrated"]) {
  background: var(--vs-success-bg);
  color: var(--vs-success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.ds-votesondhan-page .statusBadge[data-status="Migrated"] {
  background: var(--vs-warning-bg);
  color: var(--vs-warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* Empty State */
.ds-votesondhan-page .empty {
  text-align: center;
  padding: 60px 20px !important;
  color: var(--vs-text-muted);
}

/* -------------------------------------
 * PAGINATION & DEBUG
 * ------------------------------------- */
.ds-votesondhan-page .pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 30px;
}

.ds-votesondhan-page .pagination button {
  background: var(--vs-input-bg);
  border: 1px solid var(--vs-input-border);
  color: var(--vs-text-main);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: all var(--vs-transition);
}

.ds-votesondhan-page .pagination button:hover:not(:disabled) {
  border-color: var(--vs-primary);
  color: var(--vs-primary);
  background: rgba(59, 130, 246, 0.1);
  transform: scale(1.05);
}

.ds-votesondhan-page .pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ds-votesondhan-page #pageInfo {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 1px;
}

.ds-votesondhan-page .debug {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px dashed var(--vs-card-border);
}

.ds-votesondhan-page .debug summary {
  color: var(--vs-text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  user-select: none;
}

.ds-votesondhan-page .debug summary:hover {
  color: var(--vs-text-main);
}

.ds-votesondhan-page .debug pre {
  margin-top: 12px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--vs-card-border);
  padding: 16px;
  border-radius: var(--vs-border-radius-sm);
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  color: #a1a1aa;
  max-height: 300px;
  overflow: auto;
}

/* Utility */
.ds-votesondhan-page .hidden {
  display: none !important;
}

/* -------------------------------------
 * RESPONSIVE (Strict Constraints)
 * ------------------------------------- */
@media (max-width: 1024px) {
  .ds-votesondhan-page .toolbar {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: 
      "search search"
      "field status"
      "clear .";
  }
  .ds-votesondhan-page .searchWrap { grid-area: search; }
  .ds-votesondhan-page #field { grid-area: field; }
  .ds-votesondhan-page #status { grid-area: status; }
  .ds-votesondhan-page #clear { grid-area: clear; }
}

@media (max-width: 768px) {
  .ds-votesondhan-page .card {
    padding: 20px;
  }
  
  .ds-votesondhan-page .resultHead {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .ds-votesondhan-page #newFile {
    width: 100%;
  }

  .ds-votesondhan-page .metaRow {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .ds-votesondhan-page {
    padding-top: 80px !important;
  }

  .ds-votesondhan-page .toolbar {
    grid-template-columns: 1fr;
    grid-template-areas: none;
    display: flex;
    flex-direction: column;
  }
  
  .ds-votesondhan-page .toolbar > * {
    width: 100%;
  }
}

/* Respect Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .ds-votesondhan-page *,
  .ds-votesondhan-page *::before,
  .ds-votesondhan-page *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
