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

:root {
  /* Color System */
  --color-white: #ffffff;
  --color-black: #000000;
  --color-cream-50: #fcfcf9;
  --color-cream-100: #fffefd;
  --color-gray-200: #f5f5f5;
  --color-gray-300: #a7a9a9;
  --color-gray-400: #777c7c;
  --color-slate-500: #626c71;
  --color-brown-600: #5e5240;
  --color-charcoal-700: #1f2121;
  --color-charcoal-800: #262828;
  --color-slate-900: #13343b;
  --color-teal-300: #32b8c6;
  --color-teal-400: #2da6b2;
  --color-teal-500: #21808d;
  --color-teal-600: #1d7480;
  --color-teal-700: #1a6873;
  --color-teal-800: #2996a1;
  --color-red-400: #ff5459;
  --color-red-500: #c0152f;
  --color-orange-400: #e68161;
  --color-orange-500: #a84b2f;

  /* Semantic Colors */
  --color-background: var(--color-cream-50);
  --color-surface: var(--color-cream-100);
  --color-text: var(--color-charcoal-700);
  --color-text-secondary: var(--color-slate-500);
  --color-border: var(--color-gray-200);
  --color-primary: var(--color-teal-500);
  --color-primary-hover: var(--color-teal-600);
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: var(--color-red-500);
}

/* Base Typography */
html {
  font-size: 16px;
  line-height: 1.5;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

html[data-lang="zh"] {
  font-family: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'PingFang TC', 'Microsoft JhengHei', sans-serif;
}

body {
  background-color: var(--color-background);
  color: var(--color-text);
  line-height: 1.6;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.main {
  min-height: calc(100vh - 200px);
  padding: 2rem 0;
}

/* Header */
.header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header__content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.header__brand {
  flex-shrink: 0;
}

.brand-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-teal-500);
  text-decoration: none;
}

.header__nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  transition: opacity 0.3s ease;
}

.header__nav.hidden {
  display: none;
}

.nav-link {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  padding: 0.5rem 0;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  cursor: pointer;
}

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

.header__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* Language Switcher */
.language-switcher button {
  background: var(--color-teal-500);
  color: white;
  border: none;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.language-switcher button:hover {
  background: var(--color-teal-600);
}

/* Client Navigation */
.client-nav {
  background: linear-gradient(135deg, var(--color-teal-500), var(--color-teal-600));
  padding: 0.5rem 1rem;
  border-radius: 8px;
  margin: 0 1rem;
}

.client-nav .nav-link {
  color: white;
  font-weight: 500;
  border-bottom: none;
}

.client-nav .nav-link:hover,
.client-nav .nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: white;
}

/* Freelancer Navigation */
.freelancer-nav {
  background: linear-gradient(135deg, var(--color-orange-400), var(--color-orange-500));
  padding: 0.5rem 1rem;
  border-radius: 8px;
  margin: 0 1rem;
}

.freelancer-nav .nav-link {
  color: white;
  font-weight: 500;
  border-bottom: none;
}

.freelancer-nav .nav-link:hover,
.freelancer-nav .nav-link.active {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  color: white;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.btn--sm {
  padding: 0.5rem 1rem;
  font-size: 0.75rem;
}

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

.btn--primary:hover {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}

.btn--outline {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

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

.btn--secondary {
  background: var(--color-gray-200);
  color: var(--color-text);
}

.btn--secondary:hover {
  background: var(--color-gray-300);
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-menu.hidden {
  display: none;
}

.user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
  font-size: 0.875rem;
}

.user-name {
  font-weight: 600;
  color: var(--color-text);
}

.user-type {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Cards */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s;
}

.card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
}

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

/* Dashboard */
.dashboard {
  padding: 2rem 0;
}

.dashboard__header {
  background: linear-gradient(135deg, var(--color-teal-500), var(--color-teal-600));
  color: white;
  padding: 2rem;
  border-radius: 12px;
  margin-bottom: 2rem;
}

.dashboard__header.freelancer {
  background: linear-gradient(135deg, var(--color-orange-400), var(--color-orange-500));
}

.dashboard__title {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.dashboard__subtitle {
  font-size: 1.125rem;
  opacity: 0.9;
  margin: 0;
}

.dashboard__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--color-surface);
  padding: 1.5rem;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  text-align: center;
}

.stat-card__number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-teal-500);
  margin: 0 0 0.25rem;
}

.stat-card__label {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin: 0;
}

/* Job Cards */
.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.job-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: all 0.2s;
}

.job-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.job-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.job-card__title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  color: var(--color-text);
}

.job-card__budget {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-primary);
}

.job-card__meta {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

.job-card__description {
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.job-card__footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.modal__content {
  background: var(--color-surface);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal__title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0;
}

.modal__close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text-secondary);
}

/* Footer Styles */
.footer {
  background: var(--color-charcoal-800);
  color: var(--color-cream-100);
  margin-top: 4rem;
  padding: 3rem 0 1.5rem;
}

.footer__content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer__section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer__title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-cream-100);
  margin: 0 0 0.5rem;
}

.footer__text {
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--color-gray-300);
  margin: 0 0 0.75rem;
}

.footer__links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer__links a {
  color: var(--color-gray-300);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
  cursor: pointer;
}

.footer__links a:hover {
  color: var(--color-teal-400);
}

.footer__bottom {
  border-top: 1px solid var(--color-slate-500);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer__legal {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.footer__legal p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-gray-300);
}

.footer__legal-links {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.footer__legal-links a {
  color: var(--color-gray-300);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.2s;
}

.footer__legal-links a:hover {
  color: var(--color-teal-400);
}

.footer__social {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.footer__social p {
  margin: 0;
  font-size: 0.875rem;
  color: var(--color-gray-300);
}

.social-links {
  display: flex;
  gap: 0.75rem;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-gray-300);
  text-decoration: none;
  transition: all 0.2s;
}

.social-link:hover {
  background: var(--color-teal-500);
  color: white;
  transform: translateY(-2px);
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.text-center {
  text-align: center;
}

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

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

/* Responsive Design */
@media (max-width: 1024px) {
  .footer__content {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .header__content {
    flex-direction: column;
    gap: 1rem;
  }

  .header__nav {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .client-nav,
  .freelancer-nav {
    margin: 0;
    width: 100%;
    justify-content: center;
  }

  .header__actions {
    order: 2;
    justify-content: space-between;
    width: 100%;
  }

  .footer__content {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .footer__bottom {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }

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

@media (max-width: 640px) {
  .container {
    padding: 0 0.75rem;
  }

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

  .dashboard__title {
    font-size: 1.5rem;
  }

  .modal__content {
    margin: 1rem;
    padding: 1.5rem;
  }
}
