/* src/public/stylesheets/main.css */

:root {
  /* 검정색 기반 컬러 팔레트 */
  --primary: #1a1a1a;
  --primary-hover: #2d2d2d;
  --primary-light: #f5f5f5;
  --primary-dark: #0d0d0d;

  --white: #ffffff;
  --gray-50: #fafafa;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;

  --text-primary: #171717;
  --text-secondary: #404040;
  --text-tertiary: #737373;
  --text-disabled: #a3a3a3;

  --border-light: #e5e5e5;
  --border-medium: #d4d4d4;

  --success: #00c73c;
  --warning: #ffa011;
  --danger: #f04452;
  --info: #3182f6;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.1);

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Pretendard Variable", Pretendard, Roboto, "Noto Sans KR", "Segoe UI",
    "Malgun Gothic", "Apple Color Emoji", "Segoe UI Emoji", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--white);
  font-family: var(--font-sans);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.app-body {
  padding-bottom: 64px;
}

.app-nav {
  background-color: var(--white) !important;
  border-bottom: 1px solid var(--border-light);
  padding: 0.875rem 0;
  box-shadow: var(--shadow-xs);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--primary) !important;
  letter-spacing: -0.02em;
  text-decoration: none;
  transition: color 0.2s ease;
}

.navbar-brand:hover {
  color: var(--primary-hover) !important;
}

.brand-text {
  font-weight: 700;
  color: var(--primary);
}

.nav-link {
  color: var(--text-secondary) !important;
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 0.5rem 0.875rem !important;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
  text-decoration: none;
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary) !important;
  background-color: var(--gray-50);
}

.nav-link.active {
  color: var(--text-primary) !important;
  font-weight: 600;
  background-color: transparent;
}

.nav-link.active::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 2px;
  background-color: var(--primary);
  border-radius: 1px;
}

.navbar-toggler {
  border: none;
  padding: 0.25rem 0.5rem;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.app-main {
  margin-top: 0;
}

.section-block {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
  padding: 24px 28px;
  margin-bottom: 1.5rem;
}

.section-header {
  margin-bottom: 1.25rem;
}

.section-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: 0.35rem;
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.surface-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid rgba(0, 0, 0, 0.04);
  box-shadow: var(--shadow-soft);
}

.post-card {
  transition: all 0.2s ease;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  background: var(--white);
  overflow: hidden;
  cursor: pointer;
}

.post-card:hover {
  border-color: var(--border-medium);
  box-shadow: var(--shadow-md);
}

/* 마감/취소된 카드 스타일 */
.post-card.closed,
.post-card.cancelled {
  opacity: 0.85;
  position: relative;
}

.post-card.closed::before,
.post-card.cancelled::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.05);
  pointer-events: none;
  z-index: 1;
  border-radius: var(--radius-md);
}

.post-image,
.post-image-placeholder {
  height: 194px;
  object-fit: cover;
  width: 100%;
  background: var(--gray-100);
}

.post-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: 0.875rem;
  font-weight: 400;
}

/* 마감/취소된 게시글 이미지 스타일 */
.post-image-closed,
.post-image-cancelled {
  opacity: 0.6;
}

.post-card .card-title {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.category-badge {
  background-color: var(--primary) !important;
  color: white !important;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  white-space: nowrap;
  margin-left: 0.5rem;
}

.post-card .card-text {
  color: var(--text-secondary);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
  margin-top: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-badge {
  background-color: var(--primary) !important;
  color: white !important;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  white-space: nowrap;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.highlight-banner {
  background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.highlight-banner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(
    90deg,
    var(--primary) 0%,
    var(--primary-hover) 100%
  );
}

#user-info-section {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

#user-info-section .highlight-banner {
  margin: 0;
  box-shadow: none;
  border: none;
}

#user-info-section h5 {
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-hover) 100%
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#user-info-section .welcome-message {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

#user-info-section small {
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.75rem;
  background: var(--surface);
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.btn {
  border-radius: 999px;
  font-weight: 600;
  border: none;
  padding: 0.55rem 1.35rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(255, 138, 61, 0.2);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(120deg, var(--black), var(--black-soft));
  color: white;
  color: #fff;
}

.btn-outline-primary {
  border: 2px solid rgba(0, 0, 0, 0.12);
  color: var(--black);
  background: transparent;
}

.btn-outline-primary:hover {
  color: #fff;
  background: var(--black);
}

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

.btn-success:hover {
  background-color: #00b637;
  border-color: #00b637;
  transform: none;
}

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

.btn-warning:hover {
  background-color: #ff8f00;
  border-color: #ff8f00;
  transform: none;
}

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

.btn-outline-danger:hover {
  background-color: var(--danger);
  color: var(--white);
  transform: none;
}

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

.btn-danger:hover {
  background-color: #e03e4c;
  border-color: #e03e4c;
  transform: none;
}

.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
}

.btn-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 0.75rem;
}

.btn-link:hover {
  color: var(--text-primary);
  background-color: var(--gray-50);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--text-body);
}

.badge {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8rem;
}

.badge-status {
  background: var(--surface-muted);
  color: var(--accent-strong);
}

.badge-status.success {
  background: rgba(48, 186, 100, 0.12);
  color: var(--success);
}

.badge-status.danger {
  background: rgba(255, 77, 79, 0.1);
  color: var(--danger);
}

.form-control,
.form-select,
.form-floating > .form-control {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-medium);
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  color: var(--text-primary);
  background-color: var(--white);
  transition: all 0.15s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 26, 26, 0.1);
  outline: none;
}

.form-control::placeholder {
  color: var(--text-tertiary);
}

.table {
  border-radius: var(--radius-md);
  overflow: hidden;
}

.toast {
  border-radius: var(--radius-md);
  border: none;
  box-shadow: var(--shadow-card);
}

.toast-header {
  background: var(--black);
  color: #fff;
  border: none;
}

.toast-body {
  background: var(--surface);
  color: var(--text-strong);
  font-weight: 600;
}

/* Joined status block (detail modal) */
.joined-status-container {
  border-radius: var(--radius-md);
  background: var(--gray-50);
  padding: 1rem;
  border: 1px solid var(--border-light);
}

/* Image preview */
#uploaded-images-preview img {
  border: 2px solid rgba(0, 0, 0, 0.04);
  border-radius: var(--radius-md);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

#uploaded-images-preview img:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.progress {
  height: 6px;
  border-radius: var(--radius-sm);
  background: var(--gray-200);
}

.progress-bar {
  background-color: var(--primary);
  border-radius: var(--radius-sm);
}

.modal-content {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-lg);
}

.modal-header {
  border-bottom: 1px solid var(--border-light);
  padding: 1.25rem 1.5rem;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-body {
  padding: 1.5rem;
  color: var(--text-primary);
}

.modal-footer {
  border-top: 1px solid var(--border-light);
  padding: 1rem 1.5rem;
}

.modal-header,
.modal-footer {
  border-color: rgba(0, 0, 0, 0.05);
}

/* Utility */
.shadow-soft {
  box-shadow: var(--shadow-soft);
}

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

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

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

.divider {
  height: 1px;
  background: var(--border-light);
  margin: 1.5rem 0;
}

/* Chat layout */
.chat-shell {
  max-width: 1200px;
  margin: 0 auto;
}

.chat-container {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  background: var(--white);
  box-shadow: var(--shadow-sm);
}

.chat-panel {
  width: 100%;
}

.chat-header .form-control {
  min-width: 180px;
}

.chat-header .btn {
  border-radius: var(--radius-sm);
}

.chat-container {
  width: 100%;
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.chat-header {
  background: var(--white);
  color: var(--text-primary);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-light);
}

.connection-status {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 0.4rem;
}

.connection-status.connected {
  background-color: var(--success);
}

.connection-status.disconnected {
  background-color: var(--danger);
}

.chat-messages {
  height: 420px;
  overflow-y: auto;
  padding: 1.25rem;
  background: var(--gray-50);
}

.message-item {
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 0.85rem;
  max-width: 72%;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.05);
}

.message-item.own-message {
  margin-left: auto;
  background: var(--primary);
  color: var(--white);
}

.message-item.other-message {
  background: var(--white);
  border: 1px solid var(--border-light);
  color: var(--text-primary);
}

.message-sender {
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.35rem;
}

.system-message {
  text-align: center;
  color: var(--text-tertiary);
  font-style: italic;
  font-size: 0.875rem;
  margin: 0.5rem 0;
}

.chat-input-area {
  padding: 1.25rem;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  border-top: 1px solid var(--border-light);
  background: var(--white);
}

.chat-input-area .form-control {
  border-radius: var(--radius-md);
}

.chat-input-area .btn {
  border-radius: var(--radius-md);
}

@media (max-width: 991px) {
  .navbar-nav {
    background: rgba(255, 255, 255, 0.9);
    border-radius: var(--radius-md);
    padding: 1rem;
    box-shadow: var(--shadow-soft);
  }

  .post-image,
  .post-image-placeholder {
    height: 180px;
  }

  .chat-messages {
    height: 360px;
  }

  .chat-header .form-control {
    min-width: 0;
  }

  .chat-header .d-flex {
    flex-wrap: wrap;
  }

  .chat-header .form-control,
  .chat-header .btn {
    margin-top: 0.5rem;
  }
}
