/* GST Invoice Tool - Main Stylesheet */
:root {
  --primary: #1a56db;
  --primary-dark: #1e40af;
  --primary-light: #dbeafe;
  --secondary: #059669;
  --accent: #f59e0b;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-lg: 12px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Navbar */
.navbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}

.navbar-brand:hover { text-decoration: none; }

.navbar-brand .brand-icon {
  width: 32px;
  height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--gray-600);
}

.navbar-user img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.nav-link {
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.15s;
}

.nav-link:hover {
  background: var(--gray-100);
  color: var(--gray-900);
  text-decoration: none;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
  line-height: 1.4;
}

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }

.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border-color: var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); }

.btn-success {
  background: var(--secondary);
  color: white;
}
.btn-success:hover { background: #047857; }

.btn-danger {
  background: var(--red-500);
  color: white;
}
.btn-danger:hover { background: var(--red-600); }

.btn-google {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
  padding: 12px 24px;
  font-size: 15px;
}
.btn-google:hover { background: var(--gray-50); box-shadow: var(--shadow); }
.btn-google img { width: 20px; height: 20px; }

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--gray-100);
}

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

.card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
}

.stat-label {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--gray-900);
  margin-top: 4px;
}

.stat-icon {
  font-size: 24px;
  margin-bottom: 8px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--gray-800);
  background: white;
  transition: border-color 0.15s;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea { min-height: 80px; resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-hint {
  font-size: 12px;
  color: var(--gray-400);
  margin-top: 4px;
}

/* Tables */
.table-container { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}

tr:hover { background: var(--gray-50); }

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

.badge-sent { background: #dbeafe; color: #1d4ed8; }
.badge-paid { background: #d1fae5; color: #059669; }
.badge-draft { background: #f3f4f6; color: #6b7280; }
.badge-overdue { background: #fee2e2; color: #dc2626; }

/* Landing Page */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
  background: linear-gradient(135deg, #1a56db 0%, #1e40af 100%);
  color: white;
}

.hero-content { max-width: 640px; }

.hero h1 {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 16px;
}

.hero p {
  font-size: 18px;
  opacity: 0.9;
  margin-bottom: 32px;
  line-height: 1.6;
}

.hero .btn-cta {
  background: white;
  color: var(--primary);
  padding: 16px 40px;
  font-size: 18px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.hero .btn-cta:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
  padding: 80px 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.feature {
  text-align: center;
  padding: 32px 24px;
}

.feature-icon {
  width: 64px;
  height: 64px;
  background: var(--primary-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 28px;
}

.feature h3 { font-size: 18px; margin-bottom: 8px; color: var(--gray-900); }
.feature p { font-size: 14px; color: var(--gray-500); line-height: 1.6; }

/* Login Page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-50);
  padding: 20px;
}

.login-card {
  background: white;
  padding: 48px 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  text-align: center;
  max-width: 420px;
  width: 100%;
}

.login-card h1 {
  font-size: 24px;
  color: var(--gray-900);
  margin-bottom: 8px;
}

.login-card p {
  color: var(--gray-500);
  margin-bottom: 32px;
  font-size: 14px;
}

.login-logo {
  width: 64px;
  height: 64px;
  background: var(--primary);
  color: white;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin: 0 auto 20px;
}

/* Dashboard */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.dashboard-header h1 { font-size: 24px; font-weight: 700; }

/* Invoice Form */
.invoice-form { max-width: 900px; }

.items-table {
  margin-bottom: 16px;
}

.items-table td { padding: 8px 8px; }

.items-table .form-input {
  padding: 6px 10px;
  font-size: 13px;
}

.add-item-btn {
  color: var(--primary);
  background: none;
  border: 1px dashed var(--gray-300);
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  margin-bottom: 16px;
}
.add-item-btn:hover { background: var(--gray-50); border-color: var(--primary); }

.remove-item-btn {
  color: var(--red-500);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
}
.remove-item-btn:hover { background: #fee2e2; }

.gst-summary {
  background: var(--gray-50);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.gst-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.gst-row.total {
  border-top: 2px solid var(--gray-300);
  margin-top: 8px;
  padding-top: 12px;
  font-weight: 700;
  font-size: 16px;
}

/* Invoice View */
.invoice-view { max-width: 800px; }

.invoice-actions {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.invoice-detail {
  padding: 20px;
}

.invoice-detail .detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
}

.invoice-detail .detail-label {
  width: 160px;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 13px;
  flex-shrink: 0;
}

.invoice-detail .detail-value {
  flex: 1;
  font-size: 14px;
}

.invoice-detail .detail-value.amount { font-weight: 700; font-size: 16px; }

/* Settings */
.settings-form { max-width: 600px; }

.settings-section {
  margin-bottom: 32px;
}

.settings-section h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  color: var(--gray-900);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 24px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  animation: slideUp 0.3s ease;
  display: none;
}

.toast-success { background: var(--secondary); }
.toast-error { background: var(--red-500); }
.toast-info { background: var(--primary); }

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

/* Loading Spinner */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: inline-block;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--gray-400);
}

.empty-state .empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-state h3 { color: var(--gray-600); margin-bottom: 8px; }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* PayU Payment Modal */
.payment-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.payment-modal-content {
  background: white;
  padding: 32px;
  border-radius: var(--radius-lg);
  max-width: 480px;
  width: 90%;
  text-align: center;
}

.payment-modal h2 { margin-bottom: 8px; }
.payment-modal .amount { font-size: 32px; font-weight: 700; color: var(--primary); margin: 16px 0; }

/* Responsive */
@media (max-width: 768px) {
  .hero h1 { font-size: 32px; }
  .form-row { grid-template-columns: 1fr; }
  .dashboard-header { flex-direction: column; gap: 16px; align-items: flex-start; }
  .invoice-actions { flex-direction: column; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .navbar { padding: 0 16px; }
  .navbar-right .nav-link { display: none; }
}
