/**
 * 회의록 작성 및 공유 개선 서비스 - 공통 스타일시트
 * Mobile First Design
 * 작성일: 2025-10-21
 */

/* ========================================
   1. CSS 변수 정의
   ======================================== */
:root {
  /* Primary Colors (Blue) */
  --primary-50: #E3F2FD;
  --primary-100: #BBDEFB;
  --primary-200: #90CAF9;
  --primary-300: #64B5F6;
  --primary-400: #42A5F5;
  --primary-500: #2196F3;
  --primary-600: #1E88E5;
  --primary-700: #1976D2;
  --primary-800: #1565C0;
  --primary-900: #0D47A1;

  /* Secondary Colors */
  --secondary-50: #E8F5E9;
  --secondary-100: #C8E6C9;
  --secondary-500: #4CAF50;
  --secondary-700: #388E3C;
  --secondary-900: #1B5E20;

  /* Accent Colors (Purple - AI) */
  --accent-50: #F3E5F5;
  --accent-100: #E1BEE7;
  --accent-500: #9C27B0;
  --accent-700: #7B1FA2;

  /* Semantic Colors */
  --success: #4CAF50;
  --success-bg: #E8F5E9;
  --warning: #FF9800;
  --warning-bg: #FFF3E0;
  --error: #F44336;
  --error-bg: #FFEBEE;
  --info: #2196F3;
  --info-bg: #E3F2FD;

  /* Neutral Colors (Gray) */
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #EEEEEE;
  --gray-300: #E0E0E0;
  --gray-400: #BDBDBD;
  --gray-500: #9E9E9E;
  --gray-600: #757575;
  --gray-700: #616161;
  --gray-800: #424242;
  --gray-900: #212121;

  /* White & Black */
  --white: #FFFFFF;
  --black: #000000;

  /* Spacing */
  --spacing-0: 0;
  --spacing-1: 4px;
  --spacing-2: 8px;
  --spacing-3: 12px;
  --spacing-4: 16px;
  --spacing-5: 20px;
  --spacing-6: 24px;
  --spacing-8: 32px;
  --spacing-10: 40px;
  --spacing-12: 48px;
  --spacing-16: 64px;

  /* Typography */
  --font-primary: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, 'Noto Sans KR', sans-serif;
  --font-secondary: 'Inter', 'Roboto', Arial, sans-serif;
  --font-code: 'Monaco', 'Courier New', monospace;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);

  /* Transitions */
  --transition-fast: 0.1s;
  --transition-normal: 0.2s;
  --transition-slow: 0.3s;

  /* Z-index */
  --z-base: 1;
  --z-dropdown: 10;
  --z-sticky: 50;
  --z-fixed: 100;
  --z-modal-backdrop: 1000;
  --z-modal: 1001;
  --z-toast: 2000;
}

/* ========================================
   2. Reset & Base Styles
   ======================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-800);
  background-color: var(--gray-50);
  min-height: 100vh;
}

/* ========================================
   3. Typography Classes
   ======================================== */
/* Headings */
.text-h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--gray-900);
}

.text-h2 {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--gray-900);
}

.text-h3 {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--gray-900);
}

.text-h4 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--gray-900);
}

.text-h5 {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--gray-900);
}

.text-h6 {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--gray-900);
}

/* Body */
.text-body-lg {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
}

.text-body {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

.text-body-sm {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
}

.text-caption {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  color: var(--gray-600);
}

/* Buttons */
.text-btn-lg {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.0;
}

.text-btn {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.0;
}

.text-btn-sm {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.0;
}

/* Label */
.text-label {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.0;
  color: var(--gray-700);
}

/* Code */
.text-code {
  font-family: var(--font-code);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
}

/* ========================================
   4. Button Styles
   ======================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-2);
  padding: var(--spacing-3) var(--spacing-6);
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
  white-space: nowrap;
  user-select: none;
}

.btn-primary {
  background: var(--primary-500);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  background: var(--primary-600);
  box-shadow: var(--shadow-md);
}

.btn-primary:active {
  background: var(--primary-700);
  transform: scale(0.98);
}

.btn-primary:disabled {
  background: var(--gray-200);
  color: var(--gray-400);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--white);
  color: var(--primary-500);
  border: 1px solid var(--primary-500);
}

.btn-secondary:hover {
  background: var(--primary-50);
  border-color: var(--primary-600);
}

.btn-text {
  background: transparent;
  color: var(--primary-500);
  padding: var(--spacing-2) var(--spacing-4);
}

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

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-full);
  background: transparent;
}

.btn-icon:hover {
  background: var(--gray-100);
}

.btn-sm {
  padding: var(--spacing-2) var(--spacing-4);
  font-size: 14px;
}

.btn-lg {
  padding: var(--spacing-4) var(--spacing-8);
  font-size: 18px;
}

/* FAB (Floating Action Button) */
.btn-fab {
  position: fixed;
  bottom: var(--spacing-6);
  right: var(--spacing-6);
  width: 56px;
  height: 56px;
  padding: 0;
  border-radius: var(--radius-full);
  background: var(--primary-500);
  color: var(--white);
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
  z-index: var(--z-fixed);
}

.btn-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(33, 150, 243, 0.5);
}

/* ========================================
   5. Form Styles
   ======================================== */
.form-group {
  margin-bottom: var(--spacing-4);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-2);
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-700);
}

.form-label.required::after {
  content: ' *';
  color: var(--error);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--spacing-3) var(--spacing-4);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-family: var(--font-primary);
  font-size: 16px; /* iOS zoom prevention */
  background: var(--white);
  transition: border-color var(--transition-normal), outline var(--transition-normal);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: 2px solid var(--primary-100);
  border-color: var(--primary-500);
}

.form-input.error,
.form-textarea.error,
.form-select.error {
  border-color: var(--error);
  outline: 2px solid rgba(244, 67, 54, 0.1);
}

.form-input:disabled,
.form-textarea:disabled,
.form-select:disabled {
  background: var(--gray-100);
  color: var(--gray-400);
  cursor: not-allowed;
}

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

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23757575' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 20px;
  padding-right: 40px;
}

.form-error {
  margin-top: var(--spacing-1);
  font-size: 12px;
  color: var(--error);
}

/* Checkbox */
.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-2);
  cursor: pointer;
  user-select: none;
}

.form-checkbox input[type="checkbox"] {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-400);
  border-radius: var(--radius-sm);
  cursor: pointer;
  appearance: none;
  background: var(--white);
  position: relative;
}

.form-checkbox input[type="checkbox"]:checked {
  background: var(--primary-500);
  border-color: var(--primary-500);
}

.form-checkbox input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--white);
  font-size: 14px;
  font-weight: 700;
}

/* ========================================
   6. Card Styles
   ======================================== */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--spacing-6);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card.clickable {
  cursor: pointer;
}

.card-header {
  margin-bottom: var(--spacing-4);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--spacing-2);
}

.card-subtitle {
  font-size: 14px;
  color: var(--gray-600);
}

.card-body {
  margin-bottom: var(--spacing-4);
}

.card-footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-2);
  padding-top: var(--spacing-4);
  border-top: 1px solid var(--gray-200);
}

/* ========================================
   7. Badge Styles
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  padding: var(--spacing-1) var(--spacing-3);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.badge-status {
  padding: 4px 12px;
}

.badge-draft {
  background: var(--warning-bg);
  color: #E65100;
}

.badge-confirmed {
  background: var(--success-bg);
  color: #2E7D32;
}

.badge-shared {
  background: var(--info-bg);
  color: var(--primary-700);
}

.badge-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--error);
  color: var(--white);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.badge-priority-high {
  background: var(--error-bg);
  color: var(--error);
}

.badge-priority-medium {
  background: var(--warning-bg);
  color: #E65100;
}

.badge-priority-low {
  background: var(--gray-100);
  color: var(--gray-700);
}

/* ========================================
   8. Modal Styles
   ======================================== */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: var(--z-modal-backdrop);
  align-items: center;
  justify-content: center;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: var(--white);
  border-radius: var(--radius-xl);
  max-width: 500px;
  width: calc(100% - 32px);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

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

.modal-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--gray-900);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--gray-600);
  cursor: pointer;
  padding: var(--spacing-2);
  line-height: 1;
}

.modal-body {
  padding: var(--spacing-6);
}

.modal-footer {
  padding: var(--spacing-6);
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-2);
}

/* Mobile: Full Screen Modal */
@media (max-width: 767px) {
  .modal-container {
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
  }
}

/* ========================================
   9. Toast / Snackbar
   ======================================== */
.toast {
  position: fixed;
  bottom: var(--spacing-6);
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: var(--white);
  padding: var(--spacing-3) var(--spacing-6);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: var(--z-toast);
  min-width: 250px;
  text-align: center;
  font-size: 14px;
  animation: slideUp 0.3s ease-out;
  display: none;
}

.toast.active {
  display: block;
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--error);
}

.toast.warning {
  background: var(--warning);
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 20px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* ========================================
   10. Layout Components
   ======================================== */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: var(--spacing-4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
}

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

.content {
  flex: 1;
  padding: var(--spacing-4);
  overflow-y: auto;
}

.footer {
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  padding: var(--spacing-4);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-around;
  padding: var(--spacing-2) 0;
  z-index: var(--z-fixed);
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-1);
  padding: var(--spacing-2);
  color: var(--gray-600);
  text-decoration: none;
  font-size: 12px;
  min-width: 60px;
  transition: color var(--transition-normal);
}

.bottom-nav-item.active {
  color: var(--primary-500);
}

.bottom-nav-icon {
  font-size: 24px;
}

/* ========================================
   11. Utility Classes
   ======================================== */
/* Display */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* Flex */
.flex-row { flex-direction: row; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }
.align-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: var(--spacing-1); }
.gap-2 { gap: var(--spacing-2); }
.gap-3 { gap: var(--spacing-3); }
.gap-4 { gap: var(--spacing-4); }
.gap-6 { gap: var(--spacing-6); }

/* Spacing */
.m-0 { margin: 0; }
.m-1 { margin: var(--spacing-1); }
.m-2 { margin: var(--spacing-2); }
.m-3 { margin: var(--spacing-3); }
.m-4 { margin: var(--spacing-4); }
.m-6 { margin: var(--spacing-6); }
.mt-2 { margin-top: var(--spacing-2); }
.mt-4 { margin-top: var(--spacing-4); }
.mb-2 { margin-bottom: var(--spacing-2); }
.mb-4 { margin-bottom: var(--spacing-4); }
.mb-6 { margin-bottom: var(--spacing-6); }

.p-0 { padding: 0; }
.p-2 { padding: var(--spacing-2); }
.p-4 { padding: var(--spacing-4); }
.p-6 { padding: var(--spacing-6); }

/* Text */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-primary { color: var(--primary-500); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-gray { color: var(--gray-600); }

/* Background */
.bg-white { background: var(--white); }
.bg-gray { background: var(--gray-50); }
.bg-primary { background: var(--primary-500); color: var(--white); }

/* Width */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }

/* ========================================
   12. Responsive Breakpoints
   ======================================== */
/* Mobile: 320px ~ 767px (default) */

/* Tablet: 768px ~ 1023px */
@media (min-width: 768px) {
  .content {
    padding: var(--spacing-6);
  }

  .text-h1 {
    font-size: 32px;
  }

  .bottom-nav {
    display: none; /* Use sidebar instead */
  }
}

/* Desktop: 1024px+ */
@media (min-width: 1024px) {
  .content {
    padding: var(--spacing-8);
  }

  .text-body-lg {
    font-size: 18px;
  }

  .text-body {
    font-size: 16px;
  }
}

/* ========================================
   13. Animations
   ======================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Loading Spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

/* ========================================
   14. Service Specific Components
   ======================================== */
/* 회의록 리스트 아이템 */
.meeting-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-3);
  padding: var(--spacing-4);
  background: var(--white);
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-2);
  cursor: pointer;
  transition: background var(--transition-normal);
}

.meeting-item:hover {
  background: var(--gray-50);
}

/* Todo 아이템 */
.todo-item {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-3);
  padding: var(--spacing-4);
  background: var(--white);
  border-radius: var(--radius-md);
  border-left: 4px solid transparent;
  margin-bottom: var(--spacing-2);
  transition: border-color var(--transition-normal);
}

.todo-item.completed {
  opacity: 0.6;
  border-left-color: var(--success);
}

.todo-item.overdue {
  border-left-color: var(--error);
}

.todo-item.due-soon {
  border-left-color: var(--warning);
}

/* 전문용어 하이라이트 */
.term-highlight {
  background: linear-gradient(180deg, transparent 60%, var(--accent-200) 60%);
  cursor: pointer;
  border-bottom: 1px dotted var(--accent-500);
  transition: background var(--transition-normal);
}

.term-highlight:hover {
  background: var(--accent-100);
}

/* AI 처리 인디케이터 */
.ai-processing {
  display: flex;
  align-items: center;
  gap: var(--spacing-2);
  padding: var(--spacing-3) var(--spacing-4);
  background: var(--accent-50);
  border-radius: var(--radius-md);
  border-left: 4px solid var(--accent-500);
  font-size: 13px;
  color: var(--accent-700);
}

.ai-icon {
  width: 20px;
  height: 20px;
  animation: spin 2s linear infinite;
}

/* 검증 완료 배지 */
.verified-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-1);
  background: var(--success);
  color: var(--white);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
}

/* ========================================
   15. Accessibility
   ======================================== */
*:focus {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
