/* m-common.css — TKQC 모바일 공통 스타일 */

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f3f4f6;
    color: #1f2937;
    padding-top: 48px;
    padding-bottom: calc(64px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}
input, select, textarea, button { font-family: inherit; font-size: 16px; touch-action: manipulation; }
button { cursor: pointer; border: none; background: none; padding: 0; }

/* ===== Fixed Header ===== */
.m-header {
    position: fixed; top: 0; left: 0; right: 0;
    height: 48px; z-index: 100;
    background: #fff; border-bottom: 1px solid #e5e7eb;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.m-header-title {
    font-size: 17px; font-weight: 700; color: #111827;
    display: flex; align-items: center; gap: 8px;
}
.m-header-actions { display: flex; align-items: center; gap: 8px; }
.m-header-btn {
    width: 36px; height: 36px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #6b7280; transition: background 0.15s;
}
.m-header-btn:active { background: #f3f4f6; }

/* ===== Bottom Navigation ===== */
.m-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0;
    height: calc(64px + env(safe-area-inset-bottom));
    background: #fff; border-top: 1px solid #e5e7eb;
    display: flex; z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
}
.m-nav-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-decoration: none; color: #9ca3af;
    font-size: 10px; font-weight: 500; gap: 2px;
    position: relative; min-height: 44px;
    transition: color 0.15s;
}
.m-nav-item i { font-size: 20px; }
.m-nav-item.active { color: #2563eb; font-weight: 700; }
.m-nav-item.active::before {
    content: ''; position: absolute; top: 2px;
    width: 4px; height: 4px; border-radius: 50%; background: #2563eb;
}
.m-nav-item.highlight { color: #f97316; }
.m-nav-item.highlight.active { color: #f97316; }
.m-nav-item:active { opacity: 0.7; }

/* ===== Stats Bar ===== */
.m-stats-bar {
    display: flex; gap: 8px; padding: 12px 16px;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.m-stats-bar::-webkit-scrollbar { display: none; }
.m-stat-pill {
    flex-shrink: 0; padding: 8px 14px; border-radius: 20px;
    background: #fff; border: 1px solid #e5e7eb;
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 500; color: #6b7280;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.m-stat-pill .m-stat-value {
    font-weight: 700; font-size: 15px; color: #111827;
}
.m-stat-pill.blue { border-color: #93c5fd; background: #eff6ff; }
.m-stat-pill.blue .m-stat-value { color: #2563eb; }
.m-stat-pill.green { border-color: #86efac; background: #f0fdf4; }
.m-stat-pill.green .m-stat-value { color: #16a34a; }
.m-stat-pill.amber { border-color: #fcd34d; background: #fffbeb; }
.m-stat-pill.amber .m-stat-value { color: #d97706; }
.m-stat-pill.red { border-color: #fca5a5; background: #fef2f2; }
.m-stat-pill.red .m-stat-value { color: #dc2626; }
.m-stat-pill.purple { border-color: #c4b5fd; background: #f5f3ff; }
.m-stat-pill.purple .m-stat-value { color: #7c3aed; }
.m-stat-pill.slate { border-color: #cbd5e1; background: #f8fafc; }
.m-stat-pill.slate .m-stat-value { color: #475569; }

/* ===== Project Filter ===== */
.m-filter-bar {
    padding: 0 16px 12px;
}
.m-filter-select {
    width: 100%; padding: 10px 12px; border-radius: 10px;
    border: 1px solid #d1d5db; background: #fff;
    font-size: 14px; color: #374151;
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center;
}

/* ===== Tab Bar ===== */
.m-tab-bar {
    display: flex; background: #fff; border-bottom: 1px solid #e5e7eb;
    padding: 0 16px;
}
.m-tab {
    flex: 1; text-align: center; padding: 12px 0;
    font-size: 14px; font-weight: 600; color: #9ca3af;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.m-tab.active { color: #2563eb; border-bottom-color: #2563eb; }
.m-tab:active { opacity: 0.7; }

/* ===== Date Group ===== */
.m-date-group { padding: 0 16px; margin-bottom: 8px; }
.m-date-header {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 0; font-size: 13px; font-weight: 600; color: #6b7280;
}
.m-date-header i { font-size: 10px; color: #9ca3af; transition: transform 0.2s; }
.m-date-header .m-date-count {
    font-size: 12px; font-weight: 400; color: #9ca3af;
}
.m-date-header.collapsed i { transform: rotate(-90deg); }

/* ===== Issue Card ===== */
.m-card {
    background: #fff; border-radius: 12px; margin: 0 16px 10px;
    border: 1px solid #e5e7eb; overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: transform 0.1s;
}
.m-card:active { transform: scale(0.985); }
.m-card-header {
    padding: 12px 14px 8px; display: flex; align-items: center;
    justify-content: space-between;
}
.m-card-no {
    font-size: 15px; font-weight: 800; color: #2563eb;
}
.m-card-project {
    font-size: 12px; color: #6b7280; margin-left: 8px;
}
.m-card-title {
    padding: 0 14px 8px; font-size: 15px; font-weight: 600; color: #111827;
    line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.m-card-body { padding: 0 14px 12px; }
.m-card-footer {
    padding: 8px 14px; border-top: 1px solid #f3f4f6;
    display: flex; align-items: center; justify-content: space-between;
    font-size: 12px; color: #9ca3af;
}

/* Card border accents */
.m-card.border-blue { border-left: 4px solid #3b82f6; }
.m-card.border-green { border-left: 4px solid #22c55e; }
.m-card.border-red { border-left: 4px solid #ef4444; }
.m-card.border-purple { border-left: 4px solid #8b5cf6; }
.m-card.border-amber { border-left: 4px solid #f59e0b; }

/* ===== Status Badge ===== */
.m-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 8px; border-radius: 10px;
    font-size: 11px; font-weight: 600;
}
.m-badge.in-progress { background: #dbeafe; color: #1d4ed8; }
.m-badge.pending-completion { background: #ede9fe; color: #6d28d9; }
.m-badge.overdue { background: #fee2e2; color: #b91c1c; }
.m-badge.completed { background: #dcfce7; color: #15803d; }
.m-badge.review { background: #dbeafe; color: #1d4ed8; }
.m-badge.urgent { background: #ffedd5; color: #c2410c; }

/* ===== Photo Thumbnails ===== */
.m-photo-row {
    display: flex; gap: 6px; overflow-x: auto;
    scrollbar-width: none; padding: 4px 0;
}
.m-photo-row::-webkit-scrollbar { display: none; }
.m-photo-thumb {
    width: 60px; height: 60px; flex-shrink: 0; border-radius: 8px;
    object-fit: cover; border: 1px solid #e5e7eb;
}

/* ===== Action Buttons ===== */
.m-action-row {
    display: flex; gap: 8px; padding: 8px 14px 12px;
}
.m-action-btn {
    flex: 1; padding: 10px 0; border-radius: 10px;
    font-size: 13px; font-weight: 600; color: #fff;
    text-align: center; min-height: 44px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: opacity 0.15s;
}
.m-action-btn:active { opacity: 0.8; }
.m-action-btn.red { background: #ef4444; }
.m-action-btn.blue { background: #3b82f6; }
.m-action-btn.green { background: #22c55e; }
.m-action-btn.purple { background: #8b5cf6; }

/* ===== Bottom Sheet ===== */
.m-sheet-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 200; opacity: 0; visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}
.m-sheet-overlay.open { opacity: 1; visibility: visible; }

.m-sheet {
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 201; background: #fff;
    border-radius: 16px 16px 0 0;
    max-height: 90vh; overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
}
.m-sheet.open { transform: translateY(0); }

.m-sheet-handle {
    width: 36px; height: 4px; border-radius: 2px;
    background: #d1d5db; margin: 10px auto 4px;
}
.m-sheet-header {
    position: sticky; top: 0; background: #fff;
    padding: 8px 16px 12px; z-index: 1;
    border-radius: 16px 16px 0 0;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid #f3f4f6;
}
.m-sheet-title { font-size: 17px; font-weight: 700; color: #111827; }
.m-sheet-close {
    width: 32px; height: 32px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    color: #9ca3af; font-size: 18px; background: #f3f4f6;
}
.m-sheet-close:active { background: #e5e7eb; }
.m-sheet-body { padding: 16px; }
.m-sheet-footer {
    position: sticky; bottom: 0; background: #fff;
    padding: 12px 16px; border-top: 1px solid #e5e7eb;
}

/* ===== Form Inputs ===== */
.m-input, .m-select, .m-textarea {
    width: 100%; padding: 12px; border-radius: 10px;
    border: 1px solid #d1d5db; background: #fff;
    font-size: 16px; color: #111827;
    min-height: 44px;
    transition: border-color 0.15s;
}
.m-input:focus, .m-select:focus, .m-textarea:focus {
    outline: none; border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}
.m-textarea { resize: vertical; min-height: 88px; }
.m-label {
    display: block; font-size: 13px; font-weight: 600;
    color: #374151; margin-bottom: 6px;
}
.m-form-group { margin-bottom: 16px; }

/* ===== Submit Button ===== */
.m-submit-btn {
    width: 100%; padding: 14px; border-radius: 12px;
    font-size: 15px; font-weight: 700; color: #fff;
    background: #3b82f6; min-height: 48px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    transition: opacity 0.15s;
}
.m-submit-btn:active { opacity: 0.8; }
.m-submit-btn:disabled { opacity: 0.5; }
.m-submit-btn.green { background: #22c55e; }
.m-submit-btn.red { background: #ef4444; }

/* ===== Toast ===== */
.m-toast {
    position: fixed; bottom: calc(80px + env(safe-area-inset-bottom));
    left: 50%; transform: translateX(-50%) translateY(20px);
    padding: 12px 20px; border-radius: 12px;
    font-size: 14px; font-weight: 500; color: #fff;
    background: #1f2937; z-index: 300;
    opacity: 0; transition: opacity 0.3s, transform 0.3s;
    max-width: calc(100vw - 32px); text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.m-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.m-toast.success { background: #16a34a; }
.m-toast.error { background: #dc2626; }
.m-toast.warning { background: #d97706; }

/* ===== Loading ===== */
.m-loading {
    display: flex; align-items: center; justify-content: center;
    padding: 40px; color: #9ca3af;
}
.m-loading .m-spinner {
    width: 28px; height: 28px; border: 3px solid #e5e7eb;
    border-top-color: #3b82f6; border-radius: 50%;
    animation: m-spin 0.6s linear infinite;
}
@keyframes m-spin { to { transform: rotate(360deg); } }

.m-loading-overlay {
    position: fixed; inset: 0; background: #fff; z-index: 150;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    transition: opacity 0.3s;
}
.m-loading-overlay.hide { opacity: 0; pointer-events: none; }
.m-loading-overlay .m-spinner { width: 36px; height: 36px; }
.m-loading-overlay p { margin-top: 12px; color: #6b7280; font-size: 14px; }

/* ===== Empty State ===== */
.m-empty {
    text-align: center; padding: 60px 20px; color: #9ca3af;
}
.m-empty i { font-size: 48px; margin-bottom: 12px; display: block; }
.m-empty p { font-size: 14px; line-height: 1.5; }

/* ===== Opinion / Comment Section ===== */
.m-opinions-toggle {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 10px; border-radius: 12px;
    background: #f3f4f6; font-size: 12px; font-weight: 600;
    color: #6b7280;
}
.m-opinions-toggle:active { background: #e5e7eb; }
.m-opinion-card {
    padding: 10px; margin: 6px 0; border-radius: 10px;
    border-left: 3px solid #22c55e; background: #f0fdf4;
}
.m-opinion-header {
    display: flex; align-items: center; gap: 6px;
    margin-bottom: 4px; font-size: 12px;
}
.m-opinion-avatar {
    width: 22px; height: 22px; border-radius: 11px;
    background: #3b82f6; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; flex-shrink: 0;
}
.m-opinion-author { font-weight: 600; color: #111827; }
.m-opinion-time { color: #9ca3af; }
.m-opinion-text { font-size: 13px; color: #374151; line-height: 1.5; padding-left: 28px; white-space: pre-wrap; }

.m-opinion-actions {
    display: flex; gap: 6px; padding-left: 28px; margin-top: 6px;
}
.m-opinion-action-btn {
    padding: 3px 8px; border-radius: 6px;
    font-size: 11px; font-weight: 500;
    display: flex; align-items: center; gap: 3px;
}
.m-opinion-action-btn.comment-btn { background: #dbeafe; color: #1d4ed8; }
.m-opinion-action-btn.edit-btn { background: #dcfce7; color: #15803d; }
.m-opinion-action-btn.delete-btn { background: #fee2e2; color: #b91c1c; }
.m-opinion-action-btn.reply-btn { background: #dbeafe; color: #1d4ed8; }

/* Comment */
.m-comment {
    margin: 4px 0 4px 28px; padding: 8px 10px; border-radius: 8px;
    background: #fff; border: 1px solid #e5e7eb; font-size: 12px;
}
.m-comment-header {
    display: flex; align-items: center; gap: 4px; margin-bottom: 2px;
}
.m-comment-avatar {
    width: 18px; height: 18px; border-radius: 9px;
    background: #9ca3af; color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 8px; font-weight: 700; flex-shrink: 0;
}
.m-comment-text { color: #374151; padding-left: 22px; }

/* Reply */
.m-reply {
    margin: 3px 0 3px 50px; padding: 6px 8px; border-radius: 6px;
    background: #eff6ff; font-size: 11px;
    border-left: 2px solid #93c5fd;
}
.m-reply-header {
    display: flex; align-items: center; gap: 3px; margin-bottom: 1px;
}
.m-reply-text { color: #374151; padding-left: 0; }

/* ===== Info Row ===== */
.m-info-row {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: #6b7280; margin: 2px 0;
}
.m-info-row i { width: 14px; text-align: center; }

/* ===== Collapsible Detail ===== */
.m-detail-toggle {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; color: #3b82f6; font-weight: 500;
    padding: 4px 0;
}
.m-detail-content {
    max-height: 0; overflow: hidden; transition: max-height 0.3s ease;
}
.m-detail-content.open { max-height: 2000px; }

/* ===== Completion Section ===== */
.m-completion-info {
    background: #f5f3ff; border: 1px solid #ddd6fe;
    border-radius: 10px; padding: 12px; margin-top: 8px;
}

/* ===== Management Fields (read-only display) ===== */
.m-field-display {
    padding: 8px 10px; background: #f9fafb; border-radius: 8px;
    border: 1px solid #e5e7eb; font-size: 13px; color: #374151;
    min-height: 36px;
}
.m-field-display.empty { color: #9ca3af; font-style: italic; }

/* ===== Radio Group ===== */
.m-radio-group { display: flex; flex-direction: column; gap: 8px; }
.m-radio-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px; border-radius: 10px; border: 1px solid #e5e7eb;
    background: #fff; min-height: 44px;
    transition: border-color 0.15s, background 0.15s;
}
.m-radio-item.selected { border-color: #3b82f6; background: #eff6ff; }
.m-radio-item input[type="radio"] { width: 18px; height: 18px; accent-color: #3b82f6; }

/* ===== Photo Upload ===== */
.m-photo-upload {
    border: 2px dashed #d1d5db; border-radius: 12px;
    padding: 20px; text-align: center; color: #9ca3af;
    transition: border-color 0.15s;
}
.m-photo-upload:active { border-color: #3b82f6; }
.m-photo-upload i { font-size: 28px; margin-bottom: 8px; }
.m-photo-upload p { font-size: 13px; }
.m-photo-preview {
    width: 100%; max-height: 200px; object-fit: contain;
    border-radius: 8px; margin-top: 8px;
}

/* ===== Fullscreen Photo Modal ===== */
.m-photo-modal {
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.9);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}
.m-photo-modal.open { opacity: 1; visibility: visible; }
.m-photo-modal img {
    max-width: 100%; max-height: 100%; object-fit: contain;
}
.m-photo-modal-close {
    position: absolute; top: 12px; right: 12px;
    width: 36px; height: 36px; border-radius: 18px;
    background: rgba(0,0,0,0.5); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
}

/* ===== Utility ===== */
.hidden { display: none !important; }
.text-ellipsis-2 {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
.text-ellipsis-3 {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
    overflow: hidden;
}
