/* ============================================
   COMPONENTS.CSS — Reusable Component Classes
   Lucky Draw Lottery Application
   ============================================ */

/* ---- Buttons ---- */

.btn {
  padding: 10px 24px;
  border-radius: var(--radius-md);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  font-size: 14px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.4;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background-color: #1a1a1a;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #333333;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-secondary);
}

.btn-gold {
  background-color: var(--accent-gold);
  color: #ffffff;
  padding: 14px 40px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.btn-gold:hover {
  background-color: var(--accent-gold-dark);
}

.btn-danger {
  background-color: #e74c3c;
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #c0392b;
}

.btn-sm {
  padding: 6px 16px;
  font-size: 13px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
}

.btn-icon:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* ---- Cards ---- */

.card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: all var(--transition);
}

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

.card-header {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 18px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

/* ---- Inputs ---- */

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition);
  background-color: #ffffff;
  color: var(--text-primary);
}

.input:focus {
  border-color: #1a1a1a;
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.1);
}

.input::placeholder {
  color: var(--text-tertiary);
}

.textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-family: inherit;
  transition: all var(--transition);
  background-color: #ffffff;
  color: var(--text-primary);
  min-height: 120px;
  resize: vertical;
}

.textarea:focus {
  border-color: #1a1a1a;
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 26, 26, 0.1);
}

.textarea::placeholder {
  color: var(--text-tertiary);
}

.input-group {
  margin-bottom: 16px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

/* ---- Toggle Switch ---- */

.toggle-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background-color: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background-color var(--transition);
  flex-shrink: 0;
}

.toggle.active {
  background-color: var(--accent-gold);
}

.toggle::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #ffffff;
  top: 2px;
  left: 2px;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.toggle.active::after {
  transform: translateX(20px);
}

.toggle-label {
  font-size: 14px;
  color: var(--text-secondary);
  user-select: none;
}

/* ---- Modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  max-width: 480px;
  width: 90%;
  transform: scale(0.95);
  transition: transform var(--transition);
  position: relative;
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-tertiary);
  font-size: 18px;
}

.modal-close:hover {
  background-color: var(--bg-secondary);
  color: var(--text-primary);
}

/* ---- Entry List ---- */

.entry-list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.entry-item {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color var(--transition);
}

.entry-item:last-child {
  border-bottom: none;
}

.entry-item:hover {
  background-color: var(--bg-secondary);
}

.entry-code {
  font-weight: 500;
  color: var(--text-primary);
}

.entry-name {
  color: var(--text-tertiary);
  font-size: 12px;
}

/* ---- Result History ---- */

.history-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.history-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  gap: 12px;
  align-items: center;
  transition: background-color var(--transition);
}

.history-item:last-child {
  border-bottom: none;
}

.history-item:hover {
  background-color: var(--bg-secondary);
}

.history-badge {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: var(--accent-gold-light);
  color: var(--accent-gold-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

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

.history-code {
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.history-name {
  font-size: 12px;
  color: var(--text-tertiary);
}

.history-time {
  font-size: 11px;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.history-delete {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-tertiary);
  font-size: 14px;
  flex-shrink: 0;
}

.history-delete:hover {
  color: var(--accent-red);
  background-color: rgba(192, 57, 43, 0.08);
}

/* ---- Badge / Counter ---- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}

.badge-gold {
  background-color: var(--accent-gold-light);
  color: var(--accent-gold-dark);
}

.badge-gray {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
}

/* ---- Tabs ---- */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  gap: 0;
}

.tab {
  padding: 10px 20px;
  font-size: 14px;
  color: var(--text-tertiary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  white-space: nowrap;
}

.tab.active {
  color: var(--text-primary);
  border-bottom-color: #1a1a1a;
  font-weight: 500;
}

.tab:hover {
  color: var(--text-primary);
}

/* ---- Music Player Bar ---- */

.music-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.music-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.music-btn:hover {
  background-color: var(--border-color);
  color: var(--text-primary);
}

.music-info {
  font-size: 12px;
  color: var(--text-tertiary);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  width: 80px;
  flex-shrink: 0;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1a1a1a;
  cursor: pointer;
  border: none;
}

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1a1a1a;
  cursor: pointer;
  border: none;
}

/* ---- File Upload ---- */

.file-upload {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}

.file-upload:hover {
  border-color: var(--accent-gold);
  background-color: rgba(245, 230, 200, 0.3);
}

.file-upload-icon {
  font-size: 32px;
  margin-bottom: 8px;
  color: var(--text-tertiary);
}

.file-upload-text {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Text */
.text-center {
  text-align: center;
}

.text-gold {
  color: var(--accent-gold);
}

/* Margin Top */
.mt-8 {
  margin-top: 8px;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

/* Margin Bottom */
.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

/* Flexbox */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

/* Gaps */
.gap-8 {
  gap: 8px;
}

.gap-12 {
  gap: 12px;
}

.gap-16 {
  gap: 16px;
}

.gap-24 {
  gap: 24px;
}

/* Visibility */
.hidden {
  display: none;
}

/* Width */
.w-full {
  width: 100%;
}

/* ---- Collapsible Sidebar Toggle ---- */

.sidebar-toggle-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 100;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: var(--text-primary);
  transition: all var(--transition);
  user-select: none;
}

.sidebar-toggle-btn:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-strong);
  transform: scale(1.05);
}

.sidebar-toggle-btn:active {
  transform: scale(0.95);
}
