/**
 * Customer Portal Styles
 * Matches admin.vvittech.com design - Dark theme with green accent
 */

:root {
  --black: #000000;
  --charcoal: #1a1a1a;
  --accent: #56ab2f;
  --accent-light: #a8e063;
  --offwhite: #f5f5f5;
  --white: #ffffff;
  --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;
  --error: #ef4444;
  --error-light: #fecaca;
  --success: #22c55e;
  --success-light: #bbf7d0;
  --info: #3b82f6;
  --info-light: #bfdbfe;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--charcoal);
  color: var(--white);
  line-height: 1.6;
  min-height: 100vh;
  background-image:
    linear-gradient(135deg, rgba(86, 171, 47, 0.08), transparent 40%),
    linear-gradient(315deg, rgba(168, 224, 99, 0.05), transparent 45%);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  color: var(--white);
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

a {
  color: var(--accent-light);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent);
}

/* ===========================
   LOGIN PAGE
   =========================== */

.login-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 768px) {
  .login-container {
    max-width: 420px;
    padding: 1.5rem;
  }
}

.login-card {
  background: rgba(26, 26, 26, 0.8);
  border: 1px solid var(--gray-800);
  border-radius: 12px;
  padding: 3rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px);
}

.logo {
  text-align: center;
  margin-bottom: 2rem;
}

.logo img {
  max-width: 180px;
  height: auto;
  filter: drop-shadow(0 0 12px rgba(86, 171, 47, 0.3));
}

.login-title {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 0.5rem;
  text-align: center;
}

.subtitle {
  color: var(--gray-400);
  text-align: center;
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

.portal-header {
  text-align: center;
  margin-bottom: 30px;
}

.portal-header h1 {
  color: var(--accent-light);
  font-size: 28px;
  margin-bottom: 5px;
}

.portal-header p {
  color: var(--gray-400);
  font-size: 16px;
}

/* Form Styles */
.login-form,
.account-form,
.password-form {
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
  transition: border-color 0.3s;
}

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

.form-group.checkbox {
  display: flex;
  align-items: center;
}

.form-group.checkbox input {
  width: auto;
  margin-right: 8px;
}

.form-group.checkbox label {
  margin-bottom: 0;
}

.error-message {
  color: var(--danger-color);
  font-size: 13px;
  margin-top: 5px;
  display: block;
}

.success-message {
  color: var(--success-color);
  font-size: 13px;
  margin-top: 5px;
  display: block;
}

/* Buttons */
.btn-login,
.btn-primary,
.btn-secondary {
  padding: 12px 24px;
  border: none;
  border-radius: 4px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-login,
.btn-primary {
  background-color: var(--primary-color);
  color: white;
  width: 100%;
}

.btn-login:hover,
.btn-primary:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.btn-secondary {
  background-color: var(--light-bg);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: #f0f0f0;
}

.btn-logout {
  background-color: var(--danger-color);
  color: white;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.3s;
}

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

.btn-link {
  background: none;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  text-decoration: underline;
  font-size: 14px;
  padding: 0 8px;
}

.btn-link:hover {
  color: var(--primary-dark);
}

.login-footer {
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.login-footer p {
  margin: 10px 0;
  font-size: 14px;
}

.login-footer a {
  color: var(--primary-color);
  text-decoration: none;
}

.login-footer a:hover {
  text-decoration: underline;
}

.security-note {
  text-align: center;
  margin-top: 20px;
  padding: 12px;
  background: #e8f5e9;
  border-radius: 4px;
  font-size: 13px;
  color: #2e7d32;
}

/* ===========================
   DASHBOARD
   =========================== */

.portal-dashboard {
  background: var(--light-bg);
}

.portal-header {
  background: white;
  box-shadow: var(--shadow);
  padding: 0;
  margin-bottom: 0;
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
}

.logo {
  flex-shrink: 0;
}

.logo h1 {
  color: var(--primary-color);
  font-size: 24px;
  margin: 0;
}

.logo p {
  margin: 0;
  font-size: 12px;
  color: #666;
}

.main-nav {
  flex: 1;
  display: flex;
  gap: 30px;
  margin: 0 30px;
}

.nav-link {
  color: var(--text-color);
  text-decoration: none;
  font-weight: 500;
  padding: 8px 0;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.user-menu {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-profile {
  text-align: right;
}

.user-company {
  display: block;
  font-weight: 600;
  color: var(--text-color);
}

.portal-content {
  max-width: 1400px;
  margin: 30px auto;
  padding: 0 20px;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s;
}

.tab-content.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--border-color);
}

.tab-header h2 {
  margin: 0;
  color: var(--text-color);
}

.filter-select,
.filter-controls {
  display: flex;
  gap: 10px;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 14px;
}

/* ===========================
   INVOICES
   =========================== */

.invoices-list {
  display: grid;
  gap: 15px;
}

.invoice-item {
  background: white;
  border-radius: 6px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

.invoice-item:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.invoice-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 15px;
}

.invoice-number {
  font-weight: 600;
  font-size: 16px;
  color: var(--primary-color);
  flex: 1;
}

.invoice-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-paid {
  background: #d4edda;
  color: #155724;
}

.status-sent {
  background: #cfe2ff;
  color: #084298;
}

.status-overdue {
  background: #f8d7da;
  color: #721c24;
}

.status-draft {
  background: #e2e3e5;
  color: #383d41;
}

.invoice-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 15px;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border-color);
}

.invoice-details > div {
  font-size: 14px;
}

.invoice-balance {
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 4px;
}

.invoice-balance.outstanding {
  color: var(--danger-color);
  background: rgba(231, 76, 60, 0.1);
}

.invoice-balance.paid {
  color: var(--success-color);
  background: rgba(46, 204, 113, 0.1);
}

.invoice-actions {
  display: flex;
  gap: 10px;
}

/* ===========================
   TICKETS
   =========================== */

.tickets-list {
  display: grid;
  gap: 15px;
}

.ticket-item {
  background: white;
  border-radius: 6px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s;
}

.ticket-item:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

.ticket-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.ticket-number {
  font-weight: 600;
  color: var(--primary-color);
  flex: 1;
}

.ticket-priority {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.priority-urgent {
  background: #f8d7da;
  color: #721c24;
}

.priority-high {
  background: #fff3cd;
  color: #856404;
}

.priority-medium {
  background: #cfe2ff;
  color: #084298;
}

.priority-low {
  background: #d1ecf1;
  color: #0c5460;
}

.ticket-status {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-open {
  background: #fff3cd;
  color: #856404;
}

.status-in_progress {
  background: #cfe2ff;
  color: #084298;
}

.status-waiting_customer {
  background: #e2e3e5;
  color: #383d41;
}

.status-resolved {
  background: #d4edda;
  color: #155724;
}

.status-closed {
  background: #d3d3d3;
  color: #555;
}

.ticket-details h4 {
  margin: 0 0 10px 0;
}

.ticket-details p {
  margin: 5px 0;
  font-size: 13px;
  color: #666;
}

/* ===========================
   MODALS
   =========================== */

.modal {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 8px;
  padding: 0;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-content.wide {
  max-width: 900px;
}

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

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 28px;
  color: #999;
  cursor: pointer;
  transition: color 0.3s;
}

.modal-close:hover {
  color: var(--text-color);
}

/* ===========================
   FORMS
   =========================== */

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.account-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
}

.account-section {
  background: white;
  border-radius: 6px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.account-section h2 {
  margin-top: 0;
  color: var(--primary-color);
  border-bottom: 2px solid var(--border-color);
  padding-bottom: 10px;
}

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

.loading {
  text-align: center;
  padding: 40px;
  color: #999;
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: #999;
  font-style: italic;
}

.info-message {
  background: #d1ecf1;
  color: #0c5460;
  padding: 15px;
  border-radius: 4px;
  margin: 20px 0;
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 768px) {
  .header-container {
    flex-direction: column;
    gap: 15px;
  }

  .login-container {
    max-width: 420px;
    padding: 1.5rem;
  }

  .login-card {
    padding: 2rem;
  }

  .main-nav {
    margin: 0;
    gap: 15px;
    width: 100%;
    flex-wrap: wrap;
  }

  .nav-link {
    flex: 1;
    text-align: center;
  }

  .tab-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .account-container {
    grid-template-columns: 1fr;
  }

  .invoice-details,
  .form-row {
    grid-template-columns: 1fr;
  }

  .ticket-header {
    flex-wrap: wrap;
  }

  .modal-content {
    width: 100%;
    max-width: none;
    border-radius: 0;
  }
}
