/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --bg-app: #f8fafc;
  --bg-card: #ffffff;
  --border: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
}

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

/* Header */
.app-header {
  background-color: var(--primary);
  color: #ffffff;
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-md);
}

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

.logo-icon {
  color: #38bdf8;
  width: 28px;
  height: 28px;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-accent {
  color: #38bdf8;
  font-weight: 500;
}

.header-badge {
  background-color: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(56, 189, 248, 0.2);
}

.badge-dot {
  width: 8px;
  height: 8px;
  background-color: #38bdf8;
  border-radius: 50%;
  box-shadow: 0 0 8px #38bdf8;
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(0.95); opacity: 0.5; }
}

/* Layout */
.app-container {
  max-width: 1400px;
  width: 100%;
  margin: 32px auto;
  padding: 0 24px;
  display: flex;
  gap: 24px;
  flex: 1;
}

.left-column {
  width: 75%;
  display: flex;
  flex-direction: column;
}

.right-column {
  width: 25%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Table Card */
.table-card {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.table-wrapper {
  overflow-x: auto;
  flex: 1;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.invoice-table th {
  background-color: #f1f5f9;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
}

.invoice-table td {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-main);
  vertical-align: middle;
}

.invoice-table tbody tr:hover {
  background-color: #f8fafc;
}

.inv-id {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--accent);
}

.inv-customer {
  font-weight: 500;
}

.inv-amount {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--primary);
}

/* Status Badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 9999px;
}

.status-badge.draft {
  background-color: #f1f5f9;
  color: var(--text-muted);
  border: 1px solid #cbd5e1;
}

.status-badge.published {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

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

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background-color: var(--accent-hover);
}

.btn-secondary {
  background-color: #ffffff;
  color: var(--text-main);
  border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background-color: #f8fafc;
  border-color: #cbd5e1;
}

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

.btn-success:hover:not(:disabled) {
  background-color: #059669;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
}

.btn-block {
  width: 100%;
}

.actions-cell {
  display: flex;
  gap: 8px;
}

/* File Upload Box */
.upload-card {
  padding: 24px;
}

.upload-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.drop-zone {
  border: 2px dashed #cbd5e1;
  background-color: #f8fafc;
  border-radius: 10px;
  padding: 30px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: var(--accent);
  background-color: rgba(37, 99, 235, 0.05);
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.drop-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-main);
}

.drop-or {
  font-size: 12px;
  color: var(--text-muted);
  margin: 6px 0;
}

.select-file-label {
  padding: 6px 12px;
  font-size: 12px;
  margin-top: 4px;
}

.file-input-hidden {
  display: none;
}

.selected-file-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--success);
  margin-top: 10px;
  word-break: break-all;
}

/* Info Card */
.info-card {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius);
  padding: 20px;
}

.info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #1e3a8a;
  margin-bottom: 10px;
}

.info-icon {
  width: 20px;
  height: 20px;
}

.info-card h3 {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
}

.info-card ul {
  list-style-type: none;
  padding-left: 0;
}

.info-card li {
  font-size: 13px;
  color: #1e3a8a;
  margin-bottom: 8px;
  position: relative;
  padding-left: 14px;
}

.info-card li::before {
  content: "•";
  color: #3b82f6;
  font-weight: bold;
  position: absolute;
  left: 0;
}

/* Empty State */
.table-empty {
  padding: 60px 0 !important;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  color: var(--text-muted);
}

.empty-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}

/* Notification Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: var(--primary);
  color: #ffffff;
  padding: 14px 20px;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  transform: translateY(150%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast.show {
  transform: translateY(0);
}

.toast.success {
  background-color: var(--success);
}

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

/* Spinner / Loading state */
.btn-loading {
  position: relative;
  color: transparent !important;
}

.btn-loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-top: -8px;
  margin-left: -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 0.8s linear infinite;
}

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