/* ============================================
   업무 관리 시스템 스타일
   ============================================ */

:root {
    --primary: #e91e63;
    --primary-dark: #c2185b;
    --success: #4caf50;
    --warning: #ff9800;
    --danger: #f44336;
    --gray: #9e9e9e;
    --bg: #f5f5f5;
    --card: #ffffff;
    --text: #333333;
    --muted: #757575;
    --border: #e0e0e0;
    --super: #673ab7;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

/* 로그인/회원가입 */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary), #673ab7);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 { text-align: center; color: var(--primary); margin-bottom: 5px; }
.login-box .sub { text-align: center; color: var(--muted); margin-bottom: 25px; }
.login-box .link { text-align: center; margin-top: 20px; }
.login-box .link a { color: var(--primary); font-weight: 500; }

/* 폼 */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; }

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    transition: border 0.3s;
}

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

.form-group small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; }

/* 폼 행 (채널 + URL) */
.form-row { display: flex; gap: 15px; margin-bottom: 20px; }
.form-group-channel { flex: 0 0 180px; }
.form-group-url { flex: 1; }
.form-row .form-group { margin-bottom: 0; }

/* 채널 자동 감지 표시 */
.preview-channel { font-size: 12px; padding: 2px 8px; border-radius: 4px; }
.preview-channel.auto-detected { background: #e8f5e9; color: #2e7d32; }
.preview-channel.manual-select { background: #fff3e0; color: #ef6c00; }

/* 채널 수동 선택 경고 박스 */
.channel-warning-box {
    display: flex;
    align-items: center;
    gap: 15px;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border: 2px solid #ff9800;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    animation: pulse-warning 2s infinite;
}

.channel-warning-box.confirmed {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-color: #4caf50;
    animation: none;
}

@keyframes pulse-warning {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(255, 152, 0, 0); }
}

.warning-icon {
    font-size: 40px;
    flex-shrink: 0;
}

.warning-content {
    flex: 1;
}

.warning-content h4 {
    font-size: 16px;
    color: #e65100;
    margin-bottom: 5px;
}

.channel-warning-box.confirmed .warning-content h4 {
    color: #2e7d32;
}

.warning-content p {
    font-size: 14px;
    color: #6d4c00;
    margin: 0;
    line-height: 1.5;
}

.btn-warning {
    background: #ff9800;
    color: white;
    white-space: nowrap;
}

.btn-warning:hover {
    background: #f57c00;
}

/* 버튼 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: var(--gray); color: white; }
.btn-secondary:hover { background: #757575; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }

.btn-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--primary);
    background: white;
    color: var(--primary);
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

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

/* 알림 */
.alert { padding: 15px 20px; border-radius: 8px; margin-bottom: 20px; }
.alert.success { background: #e8f5e9; color: #2e7d32; border: 1px solid #a5d6a7; }
.alert.error { background: #ffebee; color: #c62828; border: 1px solid #ef9a9a; }

/* 배지 */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary);
    color: white;
}

.badge-small { padding: 2px 6px; font-size: 10px; }
.badge-gray { background: var(--gray); }
.badge-warning { background: var(--warning); }
.badge-super { background: var(--super); }

/* 레이아웃 */
.container { min-height: 100vh; display: flex; flex-direction: column; }

.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header h1 { font-size: 20px; }
.header-right { display: flex; align-items: center; gap: 15px; }

.nav {
    background: white;
    padding: 10px 20px;
    display: flex;
    gap: 5px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.nav a {
    padding: 10px 18px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.3s;
}

.nav a:hover { background: #fce4ec; }
.nav a.active { background: var(--primary); color: white; }
.nav .admin-link { margin-left: auto; }

.main { flex: 1; padding: 20px; max-width: 1200px; margin: 0 auto; width: 100%; }

.footer {
    background: white;
    padding: 15px;
    text-align: center;
    color: var(--muted);
    font-size: 14px;
    border-top: 1px solid var(--border);
}

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-size: 14px; margin-bottom: 5px; }
.back-link:hover { color: var(--primary); }

/* 카드 */
.card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.card h3 { margin-bottom: 20px; color: var(--primary); }

/* 환영 섹션 */
.welcome {
    background: linear-gradient(135deg, var(--primary), #673ab7);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 25px;
}

/* 통계 */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
}

.stat-card.mini { padding: 20px; }
.stat-icon { font-size: 35px; margin-bottom: 10px; }
.stat-num { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-sub { font-size: 18px; font-weight: 500; color: var(--muted); }
.stat-label { color: var(--muted); margin-top: 5px; }
.stat-hint { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat-link { display: block; margin-top: 15px; color: var(--primary); text-decoration: none; font-size: 14px; }

/* 채널별 통계 (내 통계 카드) */
.channel-stats { margin: 10px 0; }
.channel-stat-row { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; }
.channel-name { font-size: 14px; color: var(--text); font-weight: 500; }
.channel-value { font-size: 22px; font-weight: 700; color: var(--primary); }

/* 회원 카드 채널별 통계 */
.member-channel-stats { margin-bottom: 5px; }
.member-channel-row { display: flex; align-items: center; gap: 5px; font-size: 14px; }
.ch-label { font-size: 11px; color: var(--muted); background: var(--bg); padding: 1px 4px; border-radius: 3px; }
.ch-value { font-weight: 700; color: var(--primary); }

/* 미니 통계 바 */
.stats-mini {
    display: flex;
    gap: 30px;
    background: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stat-mini-item { text-align: center; }
.stat-mini-num { display: block; font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-mini-label { font-size: 13px; color: var(--muted); }
.stat-sub-small { font-size: 14px; font-weight: 500; color: var(--muted); }
.stat-mini-hint { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* 회원 현황 그리드 */
.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.member-card {
    display: block;
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.member-card:hover { transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.15); }
.member-card.member-me { background: linear-gradient(135deg, #fce4ec, #f8bbd9); border: 2px solid var(--primary); }
.member-name { font-weight: 600; font-size: 16px; margin-bottom: 15px; }
.member-stats { display: flex; justify-content: center; gap: 20px; }
.member-stat { display: flex; flex-direction: column; align-items: center; }
.member-stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.member-stat-sub { font-size: 14px; font-weight: 500; color: var(--muted); }
.member-stat-label { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* 회원 카드 3칸 레이아웃 */
.member-stats-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* 회원 상세 요약 */
.member-summary {
    display: flex;
    gap: 30px;
    justify-content: center;
    background: white;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.summary-item { text-align: center; }
.summary-value { display: block; font-size: 28px; font-weight: 700; color: var(--primary); }
.summary-label { font-size: 14px; color: var(--muted); }

/* 빠른 액션 */
.quick-actions {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.quick-actions h3 { margin-bottom: 15px; }
.action-btns { display: flex; gap: 10px; flex-wrap: wrap; }

/* 빈 상태 */
.empty { text-align: center; padding: 50px; color: var(--muted); }
.empty p { margin-bottom: 15px; }

/* 클립보드 그리드 */
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

.clip-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.clip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.clip-header h4 { font-size: 16px; }
.clip-actions { display: flex; gap: 5px; }

.clip-content {
    position: relative;
    padding: 20px;
    cursor: pointer;
    min-height: 80px;
    max-height: 200px;
    overflow: hidden;
}

.clip-content pre {
    font-family: 'Consolas', monospace;
    font-size: 13px;
    white-space: pre-wrap;
    word-break: break-word;
    margin: 0;
}

.copy-hover {
    position: absolute;
    inset: 0;
    background: rgba(233, 30, 99, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s;
}

.clip-content:hover .copy-hover { opacity: 1; }
.clip-footer { padding: 10px 20px; background: var(--bg); font-size: 12px; color: var(--muted); }

/* 영상 미리보기 카드 */
.video-preview-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
}

.preview-loading {
    text-align: center;
    padding: 20px;
    color: var(--muted);
}

.preview-content {
    display: flex;
    gap: 15px;
    align-items: center;
}

.preview-thumb {
    width: 160px;
    height: 90px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
}

.preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
}

.preview-info {
    flex: 1;
}

.preview-info h4 {
    font-size: 15px;
    margin-bottom: 8px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.preview-meta {
    display: flex;
    gap: 15px;
    color: var(--muted);
    font-size: 13px;
}

.preview-error {
    padding: 10px;
    color: var(--warning);
    font-size: 13px;
}

/* 작은 미리보기 (URL 입력 시) */
.video-preview-small .preview-thumb {
    width: 120px;
    height: 68px;
}

.video-preview-small .preview-thumb img,
#preview_thumbnail {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 6px;
}

.video-preview-small .preview-play {
    width: 30px;
    height: 30px;
    font-size: 12px;
}

.video-preview-small .preview-info h4 {
    font-size: 13px;
    margin-bottom: 5px;
}

.video-preview-small .preview-meta {
    font-size: 12px;
}

/* 업무 기록 */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-form { display: flex; gap: 10px; }
.filter-form select { padding: 8px 15px; border: 2px solid var(--border); border-radius: 8px; font-size: 14px; }
.filter-cnt { color: var(--muted); }

.work-list { display: flex; flex-direction: column; gap: 15px; }

.work-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    overflow: hidden;
}

.work-thumb {
    width: 200px;
    min-height: 120px;
    position: relative;
    flex-shrink: 0;
}

.work-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* 작은 썸네일 (목록용) */
.work-card-compact .work-thumb {
    width: 140px;
    min-height: 80px;
}

.play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    background: rgba(0,0,0,0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.3s;
}

.work-card-compact .play-btn {
    width: 35px;
    height: 35px;
    font-size: 14px;
}

.work-thumb:hover .play-btn { opacity: 1; }

.work-info {
    flex: 1;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.work-card-compact .work-info {
    padding: 12px 15px;
    gap: 5px;
}

.work-header { display: flex; justify-content: space-between; align-items: center; }
.work-header-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.work-date { font-weight: 600; color: var(--primary); }
.work-channel-badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.work-channel-badge.coinsekki { background: #e3f2fd; color: #1565c0; }
.work-channel-badge.bitbom { background: #fce4ec; color: #c2185b; }
.work-card-compact .work-date { font-size: 13px; }
.work-actions { display: flex; gap: 5px; }
.work-title { font-size: 15px; font-weight: 600; line-height: 1.4; }
.work-card-compact .work-title { font-size: 13px; }
.work-stats { display: flex; gap: 15px; }
.work-views { color: var(--muted); font-size: 14px; font-weight: 500; }
.work-views.over-min { color: var(--primary); font-weight: 700; }
.work-card-compact .work-views { font-size: 12px; }
.work-link { color: #2196f3; text-decoration: none; font-size: 14px; }
.work-card-compact .work-link { font-size: 12px; }
.work-link:hover { text-decoration: underline; }
.work-memo { color: var(--muted); font-size: 14px; }
.work-card-compact .work-memo { font-size: 12px; }

/* 인센티브 그리드 */
.incentive-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 15px; }

.incentive-card {
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.incentive-user { margin-bottom: 15px; }
.incentive-name { font-weight: 600; font-size: 16px; }
.incentive-value { display: flex; align-items: center; justify-content: center; gap: 15px; margin-bottom: 15px; }
.incentive-num { font-size: 36px; font-weight: 700; color: var(--primary); min-width: 60px; }
.incentive-work { font-size: 14px; color: var(--muted); }

/* 테이블 */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: var(--bg); font-weight: 600; }
.table tr:hover { background: #fafafa; }
.table .row-pending { background: #fff3e0; }
.table .row-pending:hover { background: #ffe0b2; }
.table .actions { display: flex; gap: 5px; flex-wrap: wrap; }

.status-ok { color: var(--success); }
.status-wait { color: var(--warning); }
.status-no { color: var(--danger); }
.text-muted { color: var(--muted); }

/* 토스트 */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-weight: 500;
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* 반응형 */
@media (max-width: 768px) {
    .header h1 { font-size: 16px; }
    .nav a { padding: 8px 14px; font-size: 14px; }
    .main { padding: 15px; }
    .login-box { padding: 30px 20px; }
    .clip-grid { grid-template-columns: 1fr; }
    .work-card { flex-direction: column; }
    .work-thumb { width: 100%; height: 180px; }
    .work-card-compact .work-thumb { width: 100%; height: 120px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stats-mini { flex-wrap: wrap; gap: 20px; justify-content: center; }
    .incentive-grid { grid-template-columns: 1fr 1fr; }
    .member-grid { grid-template-columns: repeat(2, 1fr); }
    .member-summary { flex-wrap: wrap; gap: 20px; }
    .table th, .table td { padding: 10px; font-size: 13px; }
    .preview-content { flex-direction: column; }
    .preview-thumb { width: 100%; height: 150px; }
    .video-preview-small .preview-thumb { width: 100%; height: 100px; }
    .form-row { flex-direction: column; gap: 0; }
    .form-group-channel { flex: 1; }
    .form-row .form-group { margin-bottom: 20px; }
    .channel-warning-box { flex-direction: column; text-align: center; }
    .warning-icon { font-size: 50px; }
}

@media (max-width: 480px) {
    .stats { grid-template-columns: 1fr; }
    .incentive-grid { grid-template-columns: 1fr; }
    .member-grid { grid-template-columns: 1fr; }
    .action-btns { flex-direction: column; }
    .page-header { flex-direction: column; gap: 15px; align-items: flex-start; }
}
