:root {
  --primary-color: #4361ee;
  --primary-dark: #3a56d4;
  --secondary-color: #f8f9fa;
  --danger-color: #f72585;
  --danger-dark: #e61576;
  --success-color: #4cc9f0;
  --warning-color: #f8961e;
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --border-color: #e9ecef;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-active: 0 0 0 3px rgba(67, 97, 238, 0.2);
  --radius: 16px;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --glow-color: rgba(67, 97, 238, 0.4);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: linear-gradient(135deg, #f5f7fb 0%, #eef2f7 100%);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  font-size: 16px;
  min-height: 100vh;
}

.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 100%;
  margin: 0 auto;
  position: relative;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: 100%;
  pointer-events: none;
}

.toast {
  background: white;
  color: var(--text-primary);
  padding: 16px 24px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 90%;
  pointer-events: auto;
  animation: slideDown 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  overflow: hidden;
}

.toast::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  width: 100%;
  background: var(--success-color);
}

.toast.error::before {
  background: var(--danger-color);
}

.toast-icon {
  font-size: 20px;
}

.toast.success .toast-icon {
  color: var(--success-color);
}

.toast.error .toast-icon {
  color: var(--danger-color);
}

.toast-message {
  font-weight: 500;
}

@keyframes slideDown {
  from {
    transform: translateY(-100px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* Header */
.app-header {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  color: white;
  padding: 24px 20px;
  box-shadow: var(--shadow-lg);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo {
    width: 48px;
    height: 48px;
    background: rgb(60 64 218);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    backdrop-filter: blur(10px);
}

.app-title h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.app-title p {
  font-size: 14px;
  opacity: 0.8;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.header-icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.header-icon-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: scale(1.05);
}

.header-icon-btn:active {
  transform: scale(0.95);
}

/* Main Content */
.app-content {
  flex: 1;
  padding: 20px;
  padding-bottom: 120px;
  overflow-y: auto;
}

/* Stats Card */
.stats-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 16px;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(67, 97, 238, 0.1);
  color: var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #ffffff;
    background: #067900;
    text-align: center;
    border-radius: 10px;
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Search Section */
.search-section {
  margin-bottom: 20px;
  transition: var(--transition);
  transform-origin: top;
}

.search-section.hidden {
  display: none;
}

.search-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
}

.search-wrapper:focus-within {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.search-icon {
  padding: 0 20px;
  color: var(--text-secondary);
  font-size: 18px;
}

.search-clear {
  width: 44px;
  height: 44px;
  background: transparent;
  color: var(--text-secondary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.search-clear:hover {
  color: var(--text-primary);
  background: rgba(0, 0, 0, 0.05);
}

/* Input Section */
.input-section {
  margin-bottom: 20px;
  position: relative;
  transition: var(--transition);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: var(--transition);
  z-index: 2;
}

.input-wrapper:focus-within {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.input-glow {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
  opacity: 0;
  z-index: 1;
  transition: var(--transition);
  filter: blur(15px);
}

.input-section.active .input-glow {
  opacity: 0.4;
  transform: scale(1.05);
}

.input-section.active::before {
content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 17px;
    z-index: 0;
    animation: pulse 2s infinite;
    background: #00ae00;
}

@keyframes pulse {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.02);
  }
  100% {
    opacity: 0.6;
    transform: scale(1);
  }
}

.input-icon {
  padding: 0 20px;
  color: var(--text-secondary);
  font-size: 18px;
  z-index: 2;
}

.modern-input {
  flex: 1;
  padding: 18px 0;
  border: none;
  background: transparent;
  font-size: 16px;
  color: var(--text-primary);
  outline: none;
  z-index: 2;
}

.modern-input::placeholder {
  color: var(--text-secondary);
}

.input-action {
  width: 56px;
  height: 56px;
  background: var(--primary-color);
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
  z-index: 2;
}

.input-action:hover {
  background: var(--primary-dark);
}

.input-action:active {
  transform: scale(0.95);
}

/* List Section */
.list-section {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.list-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.list-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
}

.refresh-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--secondary-color);
  color: var(--text-secondary);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
}

.refresh-btn:hover {
  background: #e9ecef;
  color: var(--text-primary);
}

.refresh-btn.fa-spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.awb-list {
  max-height: 400px;
  overflow-y: auto;
}

.awb-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 11px 17px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.awb-item:hover {
  background: var(--secondary-color);
}

.awb-item:last-child {
  border-bottom: none;
}

.awb-number {
  font-weight: 600;
  font-size: 16px;
  word-break: break-all;
  padding-right: 10px;
}

.delete-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(247, 37, 133, 0.1);
  color: var(--danger-color);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.delete-btn:hover {
  background: var(--danger-color);
  color: white;
  transform: scale(1.05);
}

.delete-btn:active {
  transform: scale(0.95);
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  flex-wrap: wrap;
}

.page-btn {
  padding: 8px 12px;
  background: var(--secondary-color);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 14px;
  min-width: 40px;
  min-height: 40px;
  font-weight: 500;
}

.page-btn.active {
  background: var(--primary-color);
  color: white;
}

.page-btn:hover:not(.active) {
  background: #e9ecef;
}

/* Action Buttons */
.action-buttons {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  z-index: 100;
}

.action-btn {
    flex: 1;
    padding: 16px;
    border-radius: var(--radius);
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.action-btn i {
  font-size: 20px;
}

.action-btn.primary {
  background: var(--primary-color);
  color: white;
}

.action-btn.primary:hover {
  background: var(--primary-dark);
}

.action-btn.danger {
  background: rgba(247, 37, 133, 0.1);
  color: var(--danger-color);
}

.action-btn.danger:hover {
  background: var(--danger-color);
  color: white;
}

/* Popups */
.popup-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 3000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.popup {
  background: white;
  border-radius: var(--radius);
  padding: 30px;
  max-width: 100%;
  width: 400px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: popupIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popupIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.popup-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  font-size: 28px;
}

.popup-icon.error {
  background: rgba(247, 37, 133, 0.1);
  color: var(--danger-color);
}

.popup-icon.warning {
  background: rgba(248, 150, 30, 0.1);
  color: var(--warning-color);
}

.popup h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.popup p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.popup-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.popup-btn {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  min-width: 100px;
}

.popup-btn.primary {
  background: var(--primary-color);
  color: white;
}

.popup-btn.primary:hover {
  background: var(--primary-dark);
}

.popup-btn.secondary {
  background: var(--secondary-color);
  color: var(--text-primary);
}

.popup-btn.secondary:hover {
  background: #e9ecef;
}

.popup-btn.danger {
  background: var(--danger-color);
  color: white;
}

.popup-btn.danger:hover {
  background: var(--danger-dark);
}

/* Responsive Design */
@media (min-width: 768px) {
  .app-container {
    max-width: 768px;
    margin: 0 auto;
  }
  
  .action-buttons {
    max-width: 768px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius) var(--radius) 0 0;
  }
}

@media (max-width: 480px) {
  .app-header {
    padding: 20px 16px;
  }
  
  .app-content {
    padding: 16px;
    padding-bottom: 100px;
  }
  
  .action-buttons {
    padding: 12px 16px;
  }
  
  .popup {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    position: fixed;
    bottom: 0;
    left: 0;
    transform: none;
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}