/* jh84_doc/assets/css/style.css */

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #dbeafe;
    --green: #16a34a;
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --yellow: #ca8a04;
    --yellow-light: #fef9c3;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --radius-sm: 8px;
    --radius-md: 12px;
    --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.10);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
input, select, textarea, button { font-family: inherit; }

body {
    font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login ────────────────────────────── */
.login-wrapper {
    max-width: 400px;
    margin: 120px auto;
    text-align: center;
    padding: 40px 24px;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 4px;
}

.login-sub {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 32px;
}

.google-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: #fff;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--gray-700);
    text-decoration: none;
    transition: all .15s;
}

.google-login-btn:hover {
    border-color: var(--gray-400);
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    text-decoration: none;
}

.google-icon { width: 20px; height: 20px; }

/* ── Top Bar ──────────────────────────── */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    height: 56px;
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
}

.top-bar-left { display: flex; align-items: center; gap: 16px; }
.top-bar-center { display: flex; align-items: center; gap: 12px; }
.top-bar-right { display: flex; align-items: center; gap: 12px; }

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}
.logo:hover { text-decoration: none; }

.project-selector {
    height: 34px;
    padding: 0 12px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    background: var(--white);
    cursor: pointer;
    outline: none;
    max-width: 260px;
}
.project-selector:focus { border-color: var(--primary); }

.top-bar .admin-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    text-decoration: none;
}
.top-bar .admin-link:hover {
    background: var(--gray-100);
    color: var(--gray-800);
    text-decoration: none;
}

.user-name {
    font-size: 14px;
    color: var(--gray-600);
}

.btn-logout {
    font-size: 13px;
    color: var(--gray-500);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
}
.btn-logout:hover {
    background: var(--gray-100);
    color: var(--gray-700);
    text-decoration: none;
}

/* ── Container ────────────────────────── */
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* ── Card ─────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px;
}
.card + .card { margin-top: 16px; }

/* ── Buttons ─────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-green { background: var(--green); color: var(--white); }
.btn-green:hover:not(:disabled) { background: #15803d; }

.btn-danger { background: var(--red); color: var(--white); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    padding: 8px 14px;
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--gray-800); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-outline:hover:not(:disabled) { background: var(--primary); color: var(--white); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Form ────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--gray-800);
    background: var(--white);
    outline: none;
    transition: border-color .15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
}
.form-textarea { height: 80px; padding: 10px 12px; resize: vertical; }

/* ── Toggle Switch ───────────────────── */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--gray-300);
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s;
}
.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── Badge ───────────────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
    line-height: 1.6;
}
.badge-active { background: var(--green-light); color: var(--green); }
.badge-archived { background: var(--gray-200); color: var(--gray-600); }
.badge-completed { background: var(--primary-light); color: var(--primary); }
.badge-warning { background: var(--yellow-light); color: var(--yellow); }
.badge-danger { background: var(--red-light); color: var(--red); }

.badge-role {
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 10px;
}
.badge-pm { background: var(--primary-light); color: var(--primary); }
.badge-writer { background: var(--green-light); color: var(--green); }
.badge-builder { background: var(--yellow-light); color: var(--yellow); }

/* ── Progress Bar ────────────────────── */
.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width .3s;
}
.progress-fill.complete { background: var(--green); }

/* ── Page Header ─────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}
.page-header h2 {
    font-size: 20px;
    font-weight: 700;
}

/* ── Section Header ──────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.section-header h3 {
    font-size: 16px;
    font-weight: 700;
}

/* ── Data Table ──────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--gray-50); }

.data-table .actions {
    display: flex;
    gap: 6px;
    white-space: nowrap;
}

/* ── Modal ────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.modal-content {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 28px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}
.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ── Toast ────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--white);
    box-shadow: var(--shadow-md);
    transition: opacity .3s;
    max-width: 360px;
}
.toast-info { background: var(--gray-700); }
.toast-success { background: var(--green); }
.toast-error { background: var(--red); }

/* ── Loading Overlay ─────────────────── */
#loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.7);
    z-index: 9998;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
#loading-msg { font-size: 14px; color: var(--gray-500); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ─────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}
.empty-state p { font-size: 14px; margin-top: 8px; }

/* ── Onboarding ──────────────────────── */
.onboarding-card {
    max-width: 640px;
    margin: 40px auto;
    text-align: center;
    padding: 48px 32px;
    background: var(--white);
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}
.onboarding-card h2 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}
.onboarding-card > p {
    font-size: 14px;
    color: var(--gray-500);
    margin-bottom: 24px;
}
.onboarding-roles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}
.role-card {
    padding: 16px 12px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}
.role-card strong { display: block; font-size: 14px; color: var(--gray-900); margin-bottom: 4px; }
.admin-contact {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 12px;
}

/* ── Dashboard: My Tasks ─────────────── */
.my-tasks { margin-bottom: 32px; }
.task-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-top: 12px;
}
.task-card {
    padding: 16px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--gray-600);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.task-card .count {
    font-size: 22px;
    font-weight: 700;
    color: var(--gray-800);
}
.task-card.warn { border-color: var(--yellow); }
.task-card.warn .count { color: var(--yellow); }

/* ── Dashboard: Deliverable Grid ─────── */
.deliverable-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 12px;
}
.deliverable-card {
    padding: 20px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    transition: box-shadow .15s;
}
.deliverable-card:hover { box-shadow: var(--shadow-sm); }
.deliverable-card .card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
}
.deliverable-card .card-stats {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 12px;
}
.deliverable-card .card-rate {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-600);
    margin-top: 6px;
    text-align: right;
}

/* ── Whitelist Mode Card ─────────────── */
.wl-mode-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 24px;
}
.wl-mode-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.wl-mode-desc { font-size: 13px; color: var(--gray-500); margin-bottom: 12px; }
.wl-toggle-row { display: flex; align-items: center; gap: 12px; }
.wl-toggle-label { font-size: 14px; font-weight: 500; }

/* ── Inline Flex Utils ───────────────── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--gray-500); }

/* ── Responsive ──────────────────────── */
@media (max-width: 640px) {
    .top-bar { padding: 0 16px; }
    .container { padding: 20px 16px; }
    .onboarding-roles { grid-template-columns: 1fr; }
    .task-cards { grid-template-columns: 1fr; }
    .deliverable-grid { grid-template-columns: 1fr; }
    .modal-content { padding: 20px; }
}
