/* FileListComponent.module.css - Brand Blue/Indigo & Mobile-First */

/* ===== CSS Variables ===== */
:root {
  --brand-primary: #2961eb;
  --brand-primary-700: #1d4ed8;
  --brand-secondary: #4f46e5;
  --brand-secondary-700: #4338ca;
  --brand-gradient: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
  
  --neutral-25: #fcfcfd;
  --neutral-50: #f9fafb;
  --neutral-100: #f3f4f6;
  --neutral-200: #e5e7eb;
  --neutral-300: #d1d5db;
  --neutral-400: #9ca3af;
  --neutral-600: #475569;
  --neutral-700: #374151;
  --neutral-800: #1f2937;
  --white: #ffffff;
  
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --text-on-brand: #ffffff;
  
  --border-light: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 10px rgba(2,6,23,.08);
  --shadow-lg: 0 12px 22px rgba(2,6,23,.12);
  --focus-ring: 0 0 0 3px rgba(37, 99, 235, .18);
}

/* ===== Container ===== */
.container {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 1rem;
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin: 0;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}

/* ===== Title ===== */
.title {
  margin: 0 0 1.5rem 0;
  font-size: clamp(1.125rem, 1vw + 0.8rem, 1.5rem);
  font-weight: 800;
  letter-spacing: -0.015em;
  color: var(--neutral-800);
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ===== Loading State ===== */
.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--neutral-300);
  border-top: 3px solid var(--brand-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

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

/* ===== Empty State ===== */
.emptyState {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

.emptyStateTitle {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--neutral-800);
  margin-bottom: 0.5rem;
}

.emptyStateText {
  font-size: 0.875rem;
  margin: 0;
  color: var(--text-secondary);
}

/* ===== Type List ===== */
.typeList {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: 0.75rem;
  background: var(--white);
  overflow: hidden;
}

.typeItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 60px;
}

.typeItem:last-child {
  border-bottom: none;
}

.typeItem:hover {
  background: rgba(79, 70, 229, 0.05);
  transform: translateX(4px);
}

.typeInfo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.typeNumber {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  color: var(--text-on-brand);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(41, 97, 235, 0.2);
}

.typeDetails {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.typeName {
  font-weight: 700;
  color: var(--neutral-800);
  font-size: 0.95rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.typeCount {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}

.typeArrow {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
  flex-shrink: 0;
}

/* ===== Entry Section ===== */
.entrySection {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.backButton {
  background: var(--neutral-600);
  color: var(--text-on-brand);
  border: none;
  padding: 0.75rem 1.25rem;
  border-radius: 0.6rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 2px 4px rgba(71, 85, 105, 0.2);
}

.backButton:hover {
  background: var(--neutral-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(71, 85, 105, 0.3);
}

.entryTitle {
  margin: 0 0 1rem 0;
  font-size: clamp(1rem, 0.9vw + 0.7rem, 1.25rem);
  font-weight: 700;
  color: var(--neutral-800);
}

/* ===== Entry List ===== */
.entryList {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border-light);
  border-radius: 0.75rem;
  background: var(--white);
  max-height: 400px;
  overflow-y: auto;
}

.entryItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: all 0.15s ease;
  min-height: 60px;
}

.entryItem:last-child {
  border-bottom: none;
}

.entryItem:hover {
  background: rgba(41, 97, 235, 0.05);
  transform: translateX(4px);
}

.entryInfo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.entryNumber {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  color: var(--text-on-brand);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(14, 165, 233, 0.2);
}

.entryDetails {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.entryName {
  font-weight: 700;
  color: var(--neutral-800);
  font-size: 0.9rem;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entryHint {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
}

.entryArrow {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 600;
  flex-shrink: 0;
}

/* ===== Scrollbar Styling ===== */
.entryList::-webkit-scrollbar {
  width: 8px;
}

.entryList::-webkit-scrollbar-track {
  background: var(--neutral-100);
  border-radius: 4px;
}

.entryList::-webkit-scrollbar-thumb {
  background: var(--neutral-300);
  border-radius: 4px;
  transition: background 0.2s ease;
}

.entryList::-webkit-scrollbar-thumb:hover {
  background: var(--neutral-400);
}

/* ===== Modal ===== */
.modalOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
  padding: 1rem;
  box-sizing: border-box;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal {
  background: var(--white);
  border-radius: 1rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-light);
  width: 100%;
  max-width: 900px;
  max-height: 85vh;
  overflow: hidden;
  animation: modalSlideIn 0.3s ease-out;
  display: flex;
  flex-direction: column;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modalHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.5rem 0 1.5rem;
  border-bottom: 1px solid var(--border-light);
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  flex-shrink: 0;
}

.modalTitle {
  font-size: clamp(1.125rem, 1vw + 0.8rem, 1.375rem);
  font-weight: 800;
  color: var(--neutral-800);
  margin: 0;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding-right: 1rem;
}

.closeButton {
  background: #ef4444;
  color: var(--text-on-brand);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 700;
  transition: all 0.15s ease;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.closeButton:hover {
  background: #dc2626;
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.modalContent {
  padding: 0 1.5rem 1.5rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.detailGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}

.detailItem {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.detailLabel {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.detailValue {
  font-size: 0.875rem;
  color: var(--neutral-800);
  font-weight: 600;
  padding: 0.75rem;
  background: var(--neutral-50);
  border-radius: 0.5rem;
  border: 1px solid var(--border-light);
  min-height: 44px;
  display: flex;
  align-items: center;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ===== Responsive Design ===== */

/* Mobile First - Already defined above */

/* Tablet */
@media (min-width: 768px) {
  .container {
    padding: 2rem;
    margin: 2rem auto;
    max-width: 1200px;
  }

  .typeItem,
  .entryItem {
    padding: 1.25rem;
    min-height: 70px;
  }

  .typeNumber,
  .entryNumber {
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
  }

  .typeName,
  .entryName {
    font-size: 1rem;
  }

  .modalHeader {
    padding: 2rem 2rem 0 2rem;
    margin-bottom: 2rem;
  }

  .modalContent {
    padding: 0 2rem 2rem 2rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .container {
    padding: 2.5rem;
    margin: 2.5rem auto;
  }

  .detailGrid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }

  .entryList {
    max-height: 500px;
  }
}

/* Small Mobile */
@media (max-width: 480px) {
  .container {
    padding: 1rem;
    margin: 0.5rem;
    border-radius: 0.75rem;
  }

  .typeItem,
  .entryItem {
    padding: 0.75rem;
    min-height: 56px;
  }

  .typeNumber,
  .entryNumber {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
  }

  .typeName,
  .entryName {
    font-size: 0.85rem;
  }

  .modalHeader {
    padding: 1rem 1rem 0 1rem;
    margin-bottom: 1rem;
  }

  .modalContent {
    padding: 0 1rem 1rem 1rem;
  }

  .detailGrid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .detailValue {
    padding: 0.625rem;
    font-size: 0.8125rem;
  }

  .closeButton {
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
  }
}

/* Prevent text selection on interactive elements */
.typeItem,
.entryItem,
.backButton,
.closeButton {
  user-select: none;
}

/* Focus styles for accessibility */
.typeItem:focus,
.entryItem:focus,
.backButton:focus,
.closeButton:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .typeNumber,
  .entryNumber {
    border: 2px solid var(--text-primary);
  }
  
  .modal {
    border: 2px solid var(--text-primary);
  }
}