/* ==========================================================================
   IDCard Studio - Main Application UI Styles
   Modern, Clean, Responsive Split-Pane Interface
   ========================================================================== */

:root {
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  --secondary: #0F172A;
  --accent: #0EA5E9;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --bg-page: #F8FAFC;
  --bg-panel: #FFFFFF;
  --border-color: #E2E8F0;
  --text-main: #0F172A;
  --text-muted: #64748B;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 25px rgba(0,0,0,0.12);
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-page);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* App Header */
.app-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  background: linear-gradient(135deg, var(--primary) 0%, #1E40AF 100%);
  color: #ffffff;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--secondary);
  letter-spacing: -0.3px;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--secondary);
  border-color: var(--border-color);
}
.btn-secondary:hover {
  background-color: #F1F5F9;
  border-color: #CBD5E1;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}
.btn-success:hover {
  background-color: #059669;
}

.btn-outline {
  background: transparent;
  border-color: var(--border-color);
  color: var(--text-main);
}
.btn-outline:hover {
  background-color: #F1F5F9;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11.5px;
}

/* App Main Container */
.app-main {
  flex: 1;
  display: grid;
  grid-template-columns: 520px 1fr;
  max-width: 1700px;
  width: 100%;
  margin: 0 auto;
  gap: 24px;
  padding: 24px 28px;
  box-sizing: border-box;
}

/* Left Form Panel */
.form-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  height: calc(100vh - 120px);
  overflow-y: auto;
  padding-right: 6px;
}

.form-panel::-webkit-scrollbar {
  width: 6px;
}
.form-panel::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

/* Section Card */
.form-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.form-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--secondary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.badge-counter {
  background: var(--primary-light);
  color: var(--primary);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 700;
}

/* Template Selector Carousel */
.template-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.template-card-option {
  border: 2px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  background: #ffffff;
  transition: all 0.2s ease;
  position: relative;
}

.template-card-option:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.template-card-option.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}

.template-badge {
  display: block;
  font-size: 10px;
  font-weight: 700;
  color: var(--secondary);
  line-height: 1.2;
}

.template-pill {
  display: inline-block;
  font-size: 8.5px;
  margin-top: 4px;
  padding: 1px 4px;
  border-radius: 3px;
  background: #E2E8F0;
  color: #475569;
  font-weight: 600;
}

.template-card-option.active .template-pill {
  background: var(--primary);
  color: #ffffff;
}

/* Inputs & Form Groups */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group.full-width {
  grid-column: span 2;
}

.form-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
  font-family: inherit;
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed #CBD5E1;
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
  background: #F8FAFC;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.dropzone-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.thumb-preview {
  width: 44px;
  height: 44px;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  object-fit: cover;
  background: #ffffff;
}

.dropzone-text {
  font-size: 12px;
  color: var(--text-muted);
  text-align: left;
}

.dropzone-text strong {
  color: var(--primary);
}

.photo-action-buttons {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

/* Right Live Preview Panel */
.preview-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: sticky;
  top: 85px;
  height: calc(100vh - 120px);
}

.preview-toolbar {
  width: 100%;
  max-width: 650px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.preview-spec {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.spec-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-btn {
  background: #F1F5F9;
  border: 1px solid var(--border-color);
  width: 28px;
  height: 28px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
}

.zoom-val {
  font-size: 12px;
  font-weight: 600;
  min-width: 38px;
  text-align: center;
}

/* Interactive Card Stage */
.card-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 20px;
  box-sizing: border-box;
}

/* Card Export Actions Bar */
.export-bar {
  width: 100%;
  max-width: 650px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 20px;
  background: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   Passport Photo Cropper Modal (35mm x 45mm)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.active {
  display: flex;
}

.crop-modal-box {
  background: #ffffff;
  width: 600px;
  max-width: 95vw;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 16px 20px;
  background: #F8FAFC;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--secondary);
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cropper-container-wrapper {
  width: 100%;
  height: 380px;
  background: #0F172A;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.cropper-container-wrapper img {
  max-width: 100%;
  display: block;
}

.cropper-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 14px;
}

.crop-guide-note {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 10px;
  text-align: center;
}

.modal-footer {
  padding: 14px 20px;
  background: #F8FAFC;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Toast Notification */
.toast-msg {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0F172A;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 2000;
  animation: slideUp 0.3s ease;
}

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

/* Responsive Breakpoints */
@media (max-width: 1100px) {
  .app-main {
    grid-template-columns: 1fr;
  }
  .form-panel {
    height: auto;
    overflow-y: visible;
  }
  .preview-panel {
    position: static;
    height: auto;
    margin-top: 24px;
  }
}

/* ==========================================================================
   Bulk Operations UI Styles
   ========================================================================== */

/* Header Divider */
.header-divider {
  width: 1px;
  height: 26px;
  background: var(--border-color);
  margin: 0 4px;
}

/* New Button Variants */
.btn-accent {
  background: linear-gradient(135deg, #8B5CF6 0%, #7C3AED 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 6px rgba(139, 92, 246, 0.25);
}
.btn-accent:hover {
  background: linear-gradient(135deg, #7C3AED 0%, #6D28D9 100%);
  transform: translateY(-1px);
}

.btn-gradient {
  background: linear-gradient(135deg, #F59E0B 0%, #EF4444 50%, #EC4899 100%);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}
.btn-gradient:hover {
  background: linear-gradient(135deg, #D97706 0%, #DC2626 50%, #DB2777 100%);
  transform: translateY(-1px);
}

.btn-success {
  background: linear-gradient(135deg, #10B981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25);
}
.btn-success:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
}

/* Hidden utility */
.hidden-input {
  display: none !important;
}

.hidden {
  display: none !important;
}

/* Modal Descriptions */
.modal-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.5;
}

.modal-form-group {
  margin-bottom: 16px;
}

.modal-form-group:last-child {
  margin-bottom: 0;
}

/* Institute Logo Upload */
.inst-logo-upload {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: #F8FAFC;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-top: 6px;
}

.inst-logo-img {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  object-fit: contain;
  background: #ffffff;
  padding: 4px;
}

.inst-logo-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inst-logo-actions small {
  font-size: 11px;
  color: var(--text-muted);
}

/* Info Cards */
.info-card {
  background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 16px;
}

.info-card strong {
  display: block;
  font-size: 13px;
  color: var(--secondary);
  margin-bottom: 6px;
}

.info-card p {
  font-size: 12.5px;
  color: var(--text-main);
  margin-bottom: 8px;
  line-height: 1.5;
}

.info-card small {
  font-size: 11px;
  color: var(--text-muted);
}

/* Naming Examples */
.naming-examples {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.naming-examples code {
  background: #ffffff;
  border: 1px solid #CBD5E1;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
}

/* Photo Mapping Grid */
.photo-grid-header {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
}

.photo-grid-header code {
  background: #E2E8F0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

.photo-mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}

.photo-map-item {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px;
  text-align: center;
  transition: all 0.2s ease;
}

.photo-map-item:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.photo-map-thumb {
  width: 60px;
  height: 78px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  margin-bottom: 6px;
}

.photo-map-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.photo-map-mobile {
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
}

.photo-map-file {
  font-size: 10px;
  color: var(--text-muted);
  word-break: break-all;
}

/* Column Tags */
.column-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.col-tag {
  display: inline-block;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  background: #E2E8F0;
  color: #475569;
  font-family: 'JetBrains Mono', monospace;
}

.col-tag.required {
  background: linear-gradient(135deg, #DBEAFE, #EDE9FE);
  color: var(--primary);
  border: 1px solid #93C5FD;
}

/* Import File Area */
.import-file-area {
  margin-top: 12px;
}

.import-file-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* Import Table */
.import-summary {
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 10px;
  font-weight: 600;
}

.import-count {
  display: inline-block;
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  color: #ffffff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
}

.import-note {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

.import-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.import-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}

.import-table th {
  background: #F1F5F9;
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  color: var(--secondary);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.import-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #F1F5F9;
  color: var(--text-main);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-table tr:hover td {
  background: #F8FAFC;
}

.photo-status {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  text-align: center;
  font-size: 10px;
  line-height: 18px;
  font-weight: 700;
}

.photo-status.mapped {
  background: #D1FAE5;
  color: #059669;
}

.photo-status.unmapped {
  background: #FEE2E2;
  color: #DC2626;
}

/* Import Result */
.import-result {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.import-result.success {
  background: #D1FAE5;
  border: 1px solid #6EE7B7;
  color: #065F46;
}

.import-result.error {
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  color: #991B1B;
}

.import-errors {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}

.import-errors small {
  font-size: 11px;
  color: inherit;
  opacity: 0.8;
}

/* Bulk Download UI */
.download-summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: linear-gradient(135deg, #EFF6FF, #F5F3FF);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius-md);
  margin-bottom: 16px;
}

.download-count-badge {
  background: linear-gradient(135deg, var(--primary), #8B5CF6);
  color: #ffffff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}

.download-count-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.download-count-text strong {
  font-size: 15px;
  color: var(--secondary);
}

.download-count-text small {
  font-size: 11.5px;
  color: var(--text-muted);
}

.download-card-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.download-card-row {
  display: grid;
  grid-template-columns: 30px 1fr 120px 1fr;
  gap: 10px;
  padding: 8px 12px;
  background: #F8FAFC;
  border: 1px solid #F1F5F9;
  border-radius: 4px;
  font-size: 12px;
  align-items: center;
}

.download-card-row:hover {
  background: #EFF6FF;
}

.row-num {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
}

.row-name {
  font-weight: 600;
  color: var(--text-main);
}

.row-id {
  color: var(--primary);
  font-weight: 600;
  font-size: 11px;
}

.row-dept {
  color: var(--text-muted);
  font-size: 11px;
}

.more-indicator {
  text-align: center;
  padding: 8px;
  color: var(--text-muted);
  font-size: 12px;
  font-style: italic;
}

/* Progress Bar */
.progress-bar-container {
  width: 100%;
  height: 10px;
  background: #E2E8F0;
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #8B5CF6, var(--success));
  border-radius: 5px;
  width: 0%;
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
  font-weight: 600;
}

/* Loading/Empty states */
.loading-text, .empty-state, .error-state {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: var(--text-muted);
}

.error-state {
  color: var(--danger);
}

.empty-state strong {
  color: var(--text-main);
}

.empty-state code {
  background: #E2E8F0;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11px;
}

/* Photo upload area */
.photo-upload-area {
  margin-top: 12px;
}

