/* ========================================
   East Coast Acquisitions - Investor Portal
   Matching eastcoastacq.com aesthetics
   ======================================== */

/* ── CSS Variables ── */
:root {
  --color-teal: #12a69b;
  --color-teal-dark: #0e8a81;
  --color-blue: #23a2da;
  --color-black: #000000;
  --color-dark-gray: #333333;
  --color-button: #32373c;
  --color-button-hover: #444a50;
  --color-white: #ffffff;
  --color-light-gray: #f5f7fa;
  --color-border: #e2e8f0;
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-success-text: #065f46;
  --color-error: #ef4444;
  --color-error-bg: #fef2f2;
  --color-error-text: #991b1b;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-muted: #94a3b8;

  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.12);
}

/* ── Reset & Base ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-dark-gray);
  background: var(--color-light-gray);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
}

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

a:hover {
  color: var(--color-teal-dark);
}

h1, h2, h3, h4 {
  font-weight: 700;
  color: var(--color-black);
  line-height: 1.3;
}

h1 { font-size: 36px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }

img {
  max-width: 100%;
  height: auto;
}

/* ── Header ── */
.site-header {
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--color-border);
}

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

.logo img {
  height: 44px;
  width: auto;
}

.logo-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-dark-gray);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-dark-gray);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.nav-link:hover {
  color: var(--color-teal);
  background: var(--color-light-gray);
}

.nav-link.active {
  color: var(--color-teal);
  background: rgba(18, 166, 155, 0.08);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: 16px;
  padding-left: 16px;
  border-left: 1px solid var(--color-border);
}

.user-greeting {
  font-size: 14px;
  color: var(--color-muted);
}

/* Mobile toggle */
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.mobile-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-dark-gray);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: var(--font-family);
  text-decoration: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1.4;
}

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

.btn-primary:hover {
  background-color: var(--color-button-hover);
  border-color: var(--color-button-hover);
  color: var(--color-white);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-teal {
  background-color: var(--color-teal);
  color: var(--color-white);
  border-color: var(--color-teal);
}

.btn-teal:hover {
  background-color: var(--color-teal-dark);
  border-color: var(--color-teal-dark);
  color: var(--color-white);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border-color: var(--color-button);
  color: var(--color-button);
}

.btn-outline:hover {
  background: var(--color-button);
  color: var(--color-white);
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-white);
  border-color: var(--color-danger);
}

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

.btn-sm {
  padding: 6px 16px;
  font-size: 13px;
}

.btn-block {
  display: block;
  width: 100%;
}

/* ── Flash Messages ── */
.flash {
  max-width: 1280px;
  margin: 16px auto;
  padding: 14px 24px;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  font-size: 14px;
  animation: flashIn 0.3s ease;
}

@keyframes flashIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.flash-success {
  background: var(--color-success-bg);
  border: 1px solid var(--color-success);
  color: var(--color-success-text);
}

.flash-error {
  background: var(--color-error-bg);
  border: 1px solid var(--color-error);
  color: var(--color-error-text);
}

.flash-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  padding: 0 4px;
}

.flash-close:hover {
  opacity: 1;
}

/* ── Auth Pages ── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
  padding: 40px 20px;
}

.auth-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo {
  height: 48px;
  margin-bottom: 20px;
}

.auth-header h1 {
  font-size: 28px;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--color-muted);
  font-size: 15px;
}

.auth-form {
  margin-bottom: 16px;
}

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

.auth-form .btn {
  margin-top: 8px;
}

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

.auth-footer a {
  font-size: 14px;
  color: var(--color-muted);
}

.auth-footer a:hover {
  color: var(--color-teal);
}

/* ── Dashboard Hero ── */
.dashboard-hero {
  background: linear-gradient(135deg, var(--color-teal), var(--color-blue));
  padding: 48px 32px;
  color: var(--color-white);
}

.hero-content {
  max-width: 1280px;
  margin: 0 auto;
}

.dashboard-hero h1 {
  color: var(--color-white);
  font-size: 42px;
  margin-bottom: 8px;
}

.dashboard-hero p {
  font-size: 18px;
  opacity: 0.9;
}

/* ── Section Container ── */
.section-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px;
}

/* ── Page Header ── */
.page-header {
  margin-bottom: 32px;
}

.page-header h1 {
  margin-bottom: 4px;
}

.page-header-flex {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.page-subtitle {
  color: var(--color-muted);
  font-size: 15px;
}

.page-meta {
  color: var(--color-muted);
  font-size: 14px;
  margin-top: 4px;
}

.back-link {
  display: inline-block;
  font-size: 14px;
  color: var(--color-muted);
  margin-bottom: 16px;
}

.back-link:hover {
  color: var(--color-teal);
}

/* ── Properties Grid (Investor Dashboard) ── */
.properties-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.property-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none;
  color: inherit;
  display: block;
}

.property-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

.property-image {
  position: relative;
  height: 200px;
  overflow: hidden;
  background: var(--color-border);
}

.property-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.property-card:hover .property-image img {
  transform: scale(1.05);
}

.property-image-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-light-gray);
  color: var(--color-muted);
}

.badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-new {
  background: var(--color-error);
  color: var(--color-white);
}

.property-info {
  padding: 20px;
}

.property-info h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.property-address {
  color: var(--color-muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.property-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

.property-investment {
  font-weight: 700;
  font-size: 16px;
  color: var(--color-teal);
}

.property-docs {
  font-size: 13px;
  color: var(--color-muted);
}

/* ── Documents List ── */
.documents-section {
  margin-bottom: 32px;
}

.section-title {
  font-size: 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-badge {
  background: var(--color-teal);
  color: var(--color-white);
  font-size: 13px;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.documents-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-row {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  gap: 16px;
  transition: background 0.15s ease;
}

.document-row:hover {
  background: var(--color-light-gray);
}

.document-unread {
  border-left: 4px solid var(--color-teal);
  background: #f0fdfa;
}

.document-unread:hover {
  background: #e6faf7;
}

.doc-icon {
  color: var(--color-muted);
  flex-shrink: 0;
}

.doc-info {
  flex: 1;
  min-width: 0;
}

.doc-name {
  display: block;
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-meta {
  font-size: 13px;
  color: var(--color-muted);
}

/* ── Stats Grid (Admin Dashboard) ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 20px;
  text-decoration: none;
  color: inherit;
  border: 1px solid var(--color-border);
  transition: all 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  color: inherit;
  border-color: var(--color-teal);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: rgba(18, 166, 155, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-teal);
  flex-shrink: 0;
}

.stat-number {
  display: block;
  font-size: 32px;
  font-weight: 700;
  color: var(--color-black);
  line-height: 1.2;
}

.stat-label {
  font-size: 14px;
  color: var(--color-muted);
  font-weight: 500;
}

/* ── Quick Actions ── */
.quick-actions h2 {
  margin-bottom: 16px;
}

.actions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* ── Admin Tables ── */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-white);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

.admin-table th {
  background: var(--color-light-gray);
  padding: 12px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-muted);
  white-space: nowrap;
}

.admin-table td {
  padding: 14px 20px;
  border-top: 1px solid var(--color-border);
  font-size: 14px;
  vertical-align: middle;
}

.admin-table tbody tr:hover {
  background: var(--color-light-gray);
}

.table-thumbnail {
  width: 60px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.table-thumbnail-placeholder {
  width: 60px;
  height: 40px;
  background: var(--color-light-gray);
  border-radius: var(--radius-sm);
}

.table-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inline-form {
  display: inline;
}

/* ── Property Tags ── */
.property-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  background: rgba(18, 166, 155, 0.1);
  color: var(--color-teal);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

/* ── Forms ── */
.form-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
}

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

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

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-family);
  color: var(--color-dark-gray);
  background: var(--color-white);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-teal);
  box-shadow: 0 0 0 3px rgba(18, 166, 155, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-muted);
}

.form-group input[type="file"] {
  padding: 10px;
  border-style: dashed;
  cursor: pointer;
}

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

.form-help {
  font-size: 13px;
  color: var(--color-muted);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.form-divider {
  margin: 32px 0 20px;
  padding-top: 24px;
  border-top: 1px solid var(--color-border);
}

.form-divider h2 {
  font-size: 20px;
  margin-bottom: 4px;
}

.current-image {
  margin-bottom: 12px;
}

.current-image img {
  max-height: 120px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.text-muted {
  color: var(--color-muted);
}

/* ── Property Assignment Rows ── */
.property-assignment-row {
  display: grid;
  grid-template-columns: 1fr 200px auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  background: var(--color-light-gray);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
}

.property-assignment-row .form-group {
  margin-bottom: 0;
}

.property-assignment-row .remove-property-row {
  margin-bottom: 2px;
}

#add-property-btn {
  margin-bottom: 24px;
}

/* ── Upload Card ── */
.upload-card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-border);
  margin-bottom: 32px;
}

.upload-card h2 {
  font-size: 18px;
  margin-bottom: 16px;
}

.upload-form {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.upload-form .form-group {
  flex: 1;
  min-width: 200px;
  margin-bottom: 0;
}

/* ── Empty States ── */
.empty-state {
  text-align: center;
  padding: 64px 32px;
  color: var(--color-muted);
}

.empty-icon {
  margin-bottom: 16px;
}

.empty-state h2 {
  color: var(--color-dark-gray);
  margin-bottom: 8px;
}

.empty-state-sm {
  text-align: center;
  padding: 32px;
  background: var(--color-white);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  color: var(--color-muted);
}

.empty-state-sm a {
  font-weight: 500;
}

/* ── Error Pages ── */
.error-page {
  text-align: center;
  padding: 80px 32px;
}

.error-page h1 {
  font-size: 64px;
  color: var(--color-muted);
  margin-bottom: 12px;
}

.error-page p {
  font-size: 18px;
  color: var(--color-muted);
  margin-bottom: 24px;
}

/* ── Footer ── */
.site-footer {
  background: var(--color-dark-gray);
  color: var(--color-white);
  padding: 40px 32px;
  margin-top: auto;
}

.footer-container {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-company {
  font-size: 18px;
  font-weight: 700;
}

.footer-contact {
  font-size: 14px;
  opacity: 0.8;
  margin-top: 4px;
}

.footer-links {
  display: flex;
  gap: 24px;
}

.footer-links a {
  color: var(--color-white);
  font-size: 14px;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.footer-links a:hover {
  opacity: 1;
  color: var(--color-white);
}

.footer-copy {
  width: 100%;
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin-top: 8px;
}

.footer-copy p {
  font-size: 13px;
  opacity: 0.6;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .header-container {
    padding: 12px 16px;
  }

  .mobile-toggle {
    display: flex;
  }

  .main-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-white);
    flex-direction: column;
    padding: 16px;
    border-top: 1px solid var(--color-border);
    box-shadow: var(--shadow-lg);
    gap: 4px;
  }

  .main-nav.open {
    display: flex;
  }

  .nav-user {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    margin-top: 8px;
  }

  .dashboard-hero {
    padding: 32px 16px;
  }

  .dashboard-hero h1 {
    font-size: 28px;
  }

  .section-container {
    padding: 20px 16px;
  }

  .properties-grid {
    grid-template-columns: 1fr;
  }

  .page-header-flex {
    flex-direction: column;
  }

  h1 { font-size: 28px; }

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

  .property-assignment-row {
    grid-template-columns: 1fr;
  }

  .auth-card {
    padding: 32px 24px;
  }

  .footer-container {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }

  .upload-form {
    flex-direction: column;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .table-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 480px) {
  .properties-grid {
    gap: 16px;
  }

  .property-image {
    height: 160px;
  }

  .stat-card {
    padding: 16px;
  }

  .stat-number {
    font-size: 24px;
  }
}
