/* FirstClass Dashboard Style */
:root {
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --success: #16a34a;
    --danger: #dc2626;
    --slate-800: #1e293b;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;
    --border: #e2e8f0;
    --text-main: #334155;
}

body {
    margin: 0;
    font-family: 'Noto Sans KR', sans-serif;
    color: var(--text-main);
    background-color: #f8fafc;
    font-size: 14px;
}

.dashboard-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 20px;
}

/* 1. 상단 타이틀 카드 */
.dash-header {
    background-color: var(--slate-800);
    color: #ffffff;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dash-header h1 {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 800;
}

.dash-header p {
    margin: 6px 0 0;
    font-size: 0.85rem;
    color: #94a3b8;
}

.logout-btn {
    background-color: rgba(255,255,255,0.15);
    color: #ffffff;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
}

.logout-btn:hover {
    background-color: rgba(255,255,255,0.25);
}

/* 2. 탭 메뉴 구성 */
.dash-tabs {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0 0 25px;
    padding: 0;
    border-bottom: 2px solid var(--border);
}

.dash-tabs li {
    margin-bottom: -2px;
}

.dash-tabs li a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-weight: 700;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px 8px 0 0;
    border: 2px solid transparent;
    border-bottom: none;
    transition: all 0.2s;
    cursor: pointer;
}

.dash-tabs li a svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
    display: inline-block;
}

.dash-tabs li.active a {
    border-color: var(--border);
    background-color: #ffffff;
    color: var(--primary);
    border-bottom: 2px solid #ffffff;
}

/* 3. 본문 탭 영역 */
.tab-content {
    display: none;
    background-color: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.tab-content.active {
    display: block;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--slate-800);
    margin: 0 0 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--slate-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 4. 테이블 및 뱃지 공통 */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.dash-table th {
    background-color: var(--slate-100);
    color: var(--slate-800);
    font-weight: 700;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.dash-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-main);
}

.dash-table tr:hover td {
    background-color: var(--slate-50);
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge.standby { background-color: #fef3c7; color: #d97706; }
.badge.completed { background-color: #dcfce7; color: #16a34a; }

/* 5. 폼 양식 공통 */
.form-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.form-table th {
    width: 200px;
    padding: 15px 20px;
    background-color: var(--slate-50);
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    font-weight: 700;
}

.form-table td {
    padding: 12px 20px;
    border: 1px solid var(--border);
    vertical-align: middle;
}

.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 0.9rem;
    font-family: inherit;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.hint {
    font-size: 0.8rem;
    color: #64748b;
    margin-top: 5px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary { background-color: var(--primary); color: #ffffff; }
.btn-primary:hover { background-color: var(--primary-hover); }
.btn-success { background-color: var(--success); color: #ffffff; }
.btn-success:hover { background-color: #15803d; }
.btn-danger { background-color: var(--danger); color: #ffffff; }
.btn-danger:hover { background-color: #b91c1c; }
.btn-ghost { background-color: var(--slate-100); color: var(--slate-800); border: 1px solid var(--border); }
.btn-ghost:hover { background-color: var(--slate-200); }
.btn-sm { padding: 4px 10px; font-size: 0.78rem; border-radius: 4px; }

/* 💾 디자인 저장 대형 버튼 전용 스타일 */
.btn-fcmh-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff !important;
    padding: 16px 36px;
    font-size: 1rem;
    font-weight: 800;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.15);
    transition: all 0.3s;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    text-decoration: none;
}
.btn-fcmh-save:hover {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(15, 23, 42, 0.25);
}
.btn-fcmh-save svg {
    width: 18px;
    height: 18px;
    fill: #ffffff;
    display: inline-block;
}

.dash-card {
    background-color: var(--slate-50);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
}

.dash-card-title {
    font-size: 1rem;
    font-weight: 800;
    margin: 0 0 12px;
    color: var(--slate-800);
}

/* 📁 파일 선택 고급 커스텀 스타일 */
.fcmh-file-picker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: var(--slate-50);
    border: 1px dashed var(--border);
    padding: 8px 15px;
    border-radius: 6px;
    box-sizing: border-box;
    max-width: 100%;
}
.fcmh-file-input {
    display: none !important;
}
.file-name-label {
    font-size: 0.8rem;
    color: var(--slate-500);
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.img-dimensions-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    background-color: var(--slate-200);
    color: var(--slate-800);
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 5px;
}

/* 🎚️ 프리미엄 토글 스위치 CSS */
.fcmh-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}
.fcmh-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.fcmh-slider-switch {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 34px;
}
.fcmh-slider-switch:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
input:checked + .fcmh-slider-switch {
    background-color: var(--primary);
}
input:focus + .fcmh-slider-switch {
    box-shadow: 0 0 1px var(--primary);
}
input:checked + .fcmh-slider-switch:before {
    transform: translateX(24px);
}

/* 엑셀 및 복사 버튼 시각성 강제 구제 스타일 */
.fcmh-dark-btn {
    background-color: #1e293b !important;
    color: #ffffff !important;
    border: 1px solid #1e293b !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    font-weight: 700 !important;
    font-size: 0.85rem !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    white-space: nowrap !important;
    box-shadow: 0 2px 4px rgba(30, 41, 59, 0.1) !important;
    height: auto !important;
}
.fcmh-dark-btn:hover {
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}
.fcmh-dark-btn-excel:hover {
    background-color: var(--success) !important;
    border-color: var(--success) !important;
    color: #ffffff !important;
}

/* 🍞 대시보드 전용 프리미엄 토스트 스타일 */
.fcmh-admin-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(15, 23, 42, 0.94);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #ffffff;
    padding: 20px 36px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    z-index: 999999999 !important;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Noto Sans KR', sans-serif;
    pointer-events: none;
    font-size: 1rem;
    font-weight: 700;
}
.fcmh-admin-toast.show {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}
.fcmh-admin-toast svg {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: var(--success);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

/* 🔔 이미지 삭제용 모던 내부 컨펌 모달 스타일 */
.fcmh-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999 !important;
    padding: 20px;
    box-sizing: border-box;
}
.fcmh-modal-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1), 0 10px 10px -5px rgba(0,0,0,0.04);
    animation: fcmhBounceIn 0.3s ease;
    box-sizing: border-box;
}
@keyframes fcmhBounceIn {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* 📱 모바일/태블릿 반응형 미디어 쿼리 (max-width: 768px) */
@media (max-width: 768px) {
    .dashboard-container {
        margin: 15px auto;
        padding: 0 10px;
    }

    /* 1. 헤더 영역 최적화 */
    .dash-header {
        padding: 20px;
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-bottom: 20px;
    }
    
    .dash-header h1 {
        display: flex !important;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .dash-header h1 span {
        font-size: 1.3rem !important;
    }
    
    .dash-header h1 .dash-badge {
        font-size: 0.72rem !important;
        padding: 2px 10px !important;
        margin-left: 0 !important;
    }
    
    .dash-header form {
        width: 100%;
    }
    
    .logout-btn {
        width: 100%;
        text-align: center;
        padding: 10px;
    }

    /* 2. 탭 메뉴 모바일 대응 (가로 스크롤 허용으로 깔끔하게 한 줄 스크롤 처리) */
    .dash-tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        margin: 0 0 15px;
        padding-bottom: 5px;
        border-bottom: 2px solid var(--border);
        gap: 2px;
    }
    
    .dash-tabs::-webkit-scrollbar {
        height: 4px;
    }
    
    .dash-tabs::-webkit-scrollbar-thumb {
        background-color: rgba(2, 132, 199, 0.2);
        border-radius: 4px;
    }
    
    .dash-tabs li {
        margin-bottom: -2px;
        display: inline-block;
    }
    
    .dash-tabs li a {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    /* 3. 본문 패딩 축소 */
    .tab-content {
        padding: 15px;
        border-radius: 8px;
    }
    
    .section-title {
        font-size: 1.1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding-bottom: 12px;
    }
    
    .section-title div {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .section-title form {
        width: 100% !important;
        display: flex !important;
        flex-direction: column;
        gap: 6px;
    }
    
    .section-title select {
        width: 100% !important;
        height: 36px !important;
    }
    
    .fcmh-dark-btn {
        width: 100% !important;
        justify-content: center;
        height: 38px !important;
    }

    /* 4. 접수 알림 이메일 설정 카드 모바일 대응 */
    #tab-submissions .dash-card {
        padding: 15px !important;
        flex-direction: column;
        align-items: stretch !important;
        gap: 14px !important;
    }
    
    #tab-submissions .dash-card div {
        flex-direction: column;
        align-items: flex-start !important;
        width: 100%;
    }
    
    #tab-submissions .dash-card input[type="email"] {
        max-width: 100% !important;
    }
    
    #tab-submissions .dash-card button {
        width: 100% !important;
    }

    /* 5. ⭐️ 테이블을 카드형 목록으로 완전 트랜스폼 (모바일 테이블 깨짐 원천 방지!) ⭐️ */
    .dash-table {
        border: none;
        table-layout: auto !important;
        display: block !important;
        width: 100% !important;
    }
    
    .dash-table thead {
        display: none; /* 모바일에서는 표 헤더를 숨김 */
    }
    
    .dash-table tbody {
        display: block !important;
        width: 100% !important;
    }
    
    .dash-table tbody tr {
        display: block !important;
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 12px !important;
        margin-bottom: 16px !important;
        padding: 16px !important;
        box-shadow: 0 4px 6px -1px rgba(0,0,0,0.02), 0 2px 4px -1px rgba(0,0,0,0.01) !important;
        box-sizing: border-box !important;
    }
    
    .dash-table tbody td {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        text-align: right !important;
        padding: 10px 0 !important;
        border-bottom: 1px solid #f1f5f9 !important;
        font-size: 0.82rem !important;
        min-height: 42px !important;
        box-sizing: border-box !important;
    }
    
    .dash-table tbody td:last-child {
        border-bottom: none !important;
    }
    
    /* 모바일 가독성을 위해 각 열마다 앞에 라벨(속성명)을 동적으로 부착 */
    .dash-table.submissions-table tbody td:before,
    .dash-table.stats-table tbody td:before,
    .dash-table.logs-table tbody td:before {
        content: attr(data-label) !important;
        font-weight: 800 !important;
        color: #475569 !important;
        text-align: left !important;
        flex-shrink: 0 !important;
        margin-right: 15px !important;
    }
    
    /* 복합 스택 요소 우측 정렬 세부 보강 */
    .dash-table.submissions-table tbody td strong,
    .dash-table.submissions-table tbody td span,
    .dash-table.submissions-table tbody td a {
        text-align: right !important;
    }

    /* 6. 디자인 편집 폼 테이블 반응형 최적화 */
    .form-table, .form-table tbody, .form-table tr {
        display: block;
        width: 100%;
    }
    
    .form-table th {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        padding: 10px 15px;
        border-bottom: none;
    }
    
    .form-table td {
        display: block;
        width: 100% !important;
        box-sizing: border-box;
        padding: 12px 15px;
        border-top: none;
    }
    
    .fcmh-file-picker {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .fcmh-file-picker button {
        width: 100%;
    }
    
    .file-name-label {
        max-width: 100%;
        text-align: center;
    }

    /* 7. 모달 상자 모바일 가로폭 패딩 최적화 */
    .fcmh-modal-box {
        padding: 20px;
        max-width: 90%;
    }
    
    /* 8. 통계 분석 카드 레이아웃 */
    .fcmh-stats {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .fcmh-stat-card {
        padding: 12px;
    }
    
    .fcmh-stat-card .value {
        font-size: 1.25rem;
    }
}
