:root {
  --primary-color: #4361ee;
  --primary-light: #4895ef;
  --primary-dark: #3f37c9;
  --secondary-color: #f72585;
  --text-color: #2b2d42;
  --text-light: #8d99ae;
  --background-color: #f8f9fa;
  --card-bg: rgba(255, 255, 255, 0.85);
  --error-color: #ef233c;
  --success-color: #38b000;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Poppins', sans-serif;
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: var(--text-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* Base Container */
.app-container {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 20px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.2);
  width: 100%;
  max-width: 600px;
  border: 1px solid rgba(255,255,255,0.3);
  position: relative;
}

/* Header Actions */
.header-actions {
  position: absolute;
  top: 20px; right: 20px;
  display: flex; gap: 8px; align-items: center;
}
.action-btn {
  display: flex; align-items: center; gap: 6px;
  background: transparent; color: var(--text-light);
  border: none; padding: 6px 12px;
  border-radius: 8px; font-size: 0.9rem; font-weight: 500;
  transition: all 0.2s ease; cursor: pointer; font-family: 'Poppins', sans-serif;
}
.action-btn svg { width: 14px; height: 14px; }
.action-btn:hover { background: rgba(67, 97, 238, 0.1); color: var(--primary-color); }

/* Dropdown Menu */
.dropdown { position: relative; display: inline-block; }
.dropdown-content {
  display: none; position: absolute; right: 0; top: 100%; margin-top: 5px;
  background-color: #fff; min-width: 180px; box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  border-radius: 12px; overflow: hidden; z-index: 100; border: 1px solid #eee;
  flex-direction: column;
}
.dropdown-content.show { display: flex; animation: slideDown 0.2s ease; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.dropdown-item {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 16px;
  background: transparent; border: none; text-align: left; font-size: 0.9rem;
  color: var(--text-color); cursor: pointer; font-family: 'Poppins', sans-serif;
  transition: background 0.2s;
}
.dropdown-item:hover { background: #f8f9fa; }
.dropdown-item svg { color: inherit; }
.dropdown-form { margin: 0; padding: 0; display: block; width: 100%; }
.logout-item { color: var(--error-color); }
.logout-item:hover { background: rgba(239, 35, 60, 0.05); }

/* Header & Brand */
.brand { text-align: center; margin-bottom: 30px; }
.app-logo { max-width: 180px; height: auto; margin-bottom: 15px; }
.brand h1 { font-size: 2rem; color: var(--primary-dark); font-weight: 700; letter-spacing: -0.5px; }
.subtitle { color: var(--text-light); font-size: 0.95rem; margin-top: 5px; }

/* Forms & Inputs */
.input-group { margin-bottom: 20px; text-align: left; }
.input-group label { display: block; margin-bottom: 8px; font-weight: 500; font-size: 0.9rem; color: var(--text-color); }
.input-group input {
  width: 100%; padding: 14px 15px; border-radius: 10px; border: 2px solid #e0e5ec;
  font-family: 'Poppins', sans-serif; font-size: 1rem; color: var(--text-color);
  transition: all 0.3s ease; background: #fff;
}
.input-group input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1); }

/* Buttons */
button { font-family: 'Poppins', sans-serif; cursor: pointer; transition: all 0.3s ease; }
.btn-primary {
  width: 100%; background: var(--primary-color); color: #fff; border: none; padding: 15px;
  border-radius: 10px; font-size: 1.05rem; font-weight: 600; display: flex; justify-content: center; align-items: center;
}
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(67, 97, 238, 0.3); }
.btn-secondary {
  width: 100%; background: transparent; color: var(--primary-color); border: 2px solid var(--primary-color);
  padding: 12px; border-radius: 10px; font-weight: 600;
}
.btn-secondary:hover { background: rgba(67, 97, 238, 0.1); }

/* Loader */
.loader { display: none; width: 20px; height: 20px; border: 3px solid rgba(255,255,255,0.3); border-radius: 50%; border-top-color: #fff; animation: spin 1s ease-in-out infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Results */
.error-msg { display: none; background: rgba(239, 35, 60, 0.1); color: var(--error-color); padding: 12px 15px; border-radius: 8px; margin-bottom: 20px; font-size: 0.9rem; font-weight: 500; border-left: 4px solid var(--error-color); }
.result-card { display: none; background: #fff; padding: 25px; border-radius: 15px; margin-top: 25px; box-shadow: 0 5px 20px rgba(0,0,0,0.05); text-align: left; }
.result-card h3 { color: var(--primary-dark); margin-bottom: 15px; font-size: 1.1rem; border-bottom: 2px solid #f0f2f5; padding-bottom: 10px; }
.detail-item { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 0.95rem; }
.detail-item .label { font-weight: 600; color: var(--text-light); }
.detail-item .value { font-weight: 500; text-align: right; word-break: break-all; max-width: 60%; }

/* History */
.history-section { margin-top: 30px; text-align: left; }
.history-section h4 { font-size: 1rem; color: var(--primary-dark); margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
.clear-history { font-size: 0.8rem; background: transparent; border: none; color: var(--text-light); cursor: pointer; }
.clear-history:hover { color: var(--error-color); }
.history-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.history-list li {
  background: rgba(255,255,255,0.5); padding: 10px 15px; border-radius: 8px; font-size: 0.9rem; cursor: pointer; transition: all 0.2s ease;
  display: flex; justify-content: space-between; border: 1px solid transparent;
}
.history-list li:hover { background: #fff; border-color: var(--primary-light); color: var(--primary-color); transform: translateX(5px); }
.history-pagination { display: flex; gap: 5px; justify-content: center; margin-top: 15px; }
.page-btn { background: #fff; border: 1px solid #ddd; border-radius: 4px; padding: 4px 10px; font-size: 0.85rem; cursor: pointer; color: var(--text-light); }
.page-btn.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.page-btn:hover:not(.active) { background: #f0f0f0; }

/* Modals */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5);
  backdrop-filter: blur(5px); z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-content {
  background: #fff; width: 100%; max-width: 600px; max-height: 85vh; border-radius: 15px;
  display: flex; flex-direction: column; box-shadow: 0 20px 40px rgba(0,0,0,0.2); animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.modal-header { padding: 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { font-size: 1.2rem; color: var(--primary-dark); }
.close-modal { background: none; border: none; font-size: 1.5rem; color: #888; cursor: pointer; }
.close-modal:hover { color: var(--error-color); }
.modal-body { padding: 20px; overflow-y: auto; }

/* Visual Detail View */
.detail-view { display: flex; flex-direction: column; gap: 15px; }
.detail-group { background: #f8f9fa; padding: 15px; border-radius: 10px; border: 1px solid #eef2f6; }
.detail-group h4 { font-size: 0.95rem; color: var(--primary-dark); margin-bottom: 10px; border-bottom: 1px solid #eef2f6; padding-bottom: 5px; }
.detail-row { display: flex; flex-direction: column; margin-bottom: 8px; }
.detail-row:last-child { margin-bottom: 0; }
.detail-label { font-size: 0.8rem; color: var(--text-light); font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.detail-value { font-size: 0.95rem; color: var(--text-color); font-weight: 500; word-break: break-word; }
.detail-badge { display: inline-block; padding: 4px 10px; background: rgba(67, 97, 238, 0.1); color: var(--primary-color); border-radius: 6px; font-size: 0.8rem; font-weight: 600; margin-top: 4px; }

/* Admin Panel UI */
.admin-card { background: #f8f9fa; border-radius: 10px; padding: 20px; margin-bottom: 20px; border: 1px solid #eee; }
.admin-card h3 { margin-bottom: 15px; font-size: 1.1rem; color: var(--primary-dark); }
.admin-input { width: 100%; padding: 10px; margin-bottom: 10px; border: 1px solid #ccc; border-radius: 6px; font-family: inherit; }
.btn-small { background: var(--primary-color); color: #fff; border: none; padding: 8px 15px; border-radius: 6px; cursor: pointer; font-weight: 500; }
.add-user-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 15px; padding-bottom: 15px; border-bottom: 1px solid #ddd; }
.user-list { list-style: none; }
.user-list li { display: flex; justify-content: space-between; align-items: center; padding: 10px; background: #fff; margin-bottom: 8px; border-radius: 6px; border: 1px solid #eee; }
.btn-delete { background: var(--error-color); color: white; border: none; padding: 5px 10px; border-radius: 4px; cursor: pointer; }

/* Footer */
.app-footer {
  margin-top: 40px;
  text-align: center;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.85rem;
  width: 100%;
}
