/*
 * 📁 파일 위치: /volume1/web/gpt/assets/operator_overhaul.css
 * ✅ 덮어쓰기 지시: /gpt 운영자 화면 1차 개편 CSS
 *
 * GPT_OPERATOR_OVERHAUL_CSS_V1
 * 목표:
 * - 상단 장식 버튼 숨김
 * - 하단 고정 빠른 버튼 숨김
 * - 운영자 상태판/큰 버튼 노출
 * - 태블릿 터치 영역 확대
 */

/* 기존 상단 장식 버튼 숨김: AI 개선 제안/진단/디버그/기록 */
.header-actions {
    display: none !important;
}

/* 헤더는 제목만 깔끔하게 */
.app-header {
    min-height: 64px !important;
    padding: 12px 18px !important;
    border-bottom: 1px solid rgba(148, 163, 184, 0.22) !important;
}

.header-title {
    font-size: 1.15rem !important;
    letter-spacing: -0.02em;
}

.header-sub {
    opacity: 0.78;
}

/* 새 운영자 상태판 */
.operator-panel {
    margin: 12px auto 10px;
    width: min(1120px, calc(100% - 24px));
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 16px;
    padding: 10px;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(30, 41, 59, 0.96));
    color: #e5e7eb;
    box-shadow: 0 10px 26px rgba(15, 23, 42, 0.24);
}

.operator-panel-main {
    margin-bottom: 14px;
}

.operator-eyebrow {
    color: #93c5fd;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.operator-title-row {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
}

.operator-title {
    font-size: 1.06rem;
    font-weight: 850;
    line-height: 1.35;
}

.operator-sub {
    margin-top: 6px;
    color: #cbd5e1;
    font-size: 0.88rem;
    line-height: 1.45;
}

.operator-status-pill {
    flex: 0 0 auto;
    padding: 9px 13px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 900;
    white-space: nowrap;
}

.operator-status-pill.ok {
    background: rgba(34, 197, 94, 0.16);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, 0.32);
}

.operator-status-pill.warn {
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.34);
}

.operator-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.operator-action {
    min-height: 52px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.72);
    color: #e5e7eb;
    text-decoration: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 9px 11px;
    font: inherit;
    text-align: left;
    transition: transform .12s ease, border-color .12s ease, background .12s ease;
}

.operator-action:hover {
    transform: translateY(-1px);
    border-color: rgba(56, 189, 248, 0.52);
    background: rgba(30, 41, 59, 0.94);
}

.operator-action span {
    font-size: 0.94rem;
    font-weight: 900;
}

.operator-action small {
    margin-top: 3px;
    color: #94a3b8;
    font-size: 0.78rem;
}

.operator-action.primary {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.32), rgba(59, 130, 246, 0.22));
    border-color: rgba(56, 189, 248, 0.5);
}

.operator-action.soft {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.22);
}

/* 하단 고정 빠른 버튼 제거 */
.quick-chips,
.quick-chips-workbench {
    display: none !important;
}

/* 입력창 중심으로 */
.app-body {
    padding-bottom: 18px !important;
}

.answer-wrapper {
    width: min(1120px, calc(100% - 24px)) !important;
    margin: 0 auto !important;
}

.answer-box {
    min-height: 48vh !important;
    border-radius: 18px !important;
}

.input-area {
    width: min(1120px, calc(100% - 24px)) !important;
    margin: 12px auto 0 !important;
    position: sticky;
    bottom: 0;
    z-index: 20;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 35px rgba(15, 23, 42, 0.16);
}

.input-row textarea,
#q {
    min-height: 58px !important;
    font-size: 1rem !important;
}

#askBtn {
    min-width: 92px !important;
    min-height: 58px !important;
    font-weight: 900 !important;
}

/* 작고 애매한 수리 콘솔 버튼은 숨김.
   새 상태판의 SSH 답변 버튼으로 대체. */
.repair-console-btn,
#repairConsoleButton,
.repair-console-button,
.floating-repair-console {
    display: none !important;
}

/* proactive 버블은 기본적으로 덜 튀게 */
#proactiveBubble,
.proactive-bubble {
    max-width: min(520px, calc(100vw - 24px)) !important;
}

/* 태블릿/모바일 */
@media (max-width: 900px) {
    .operator-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .operator-title-row {
        flex-direction: column;
    }

    .operator-action {
        min-height: 54px;
    }

    .answer-box {
        min-height: 46vh !important;
    }
}

@media (max-width: 520px) {
    .operator-panel {
        width: 100%;
        margin-top: 0;
        border-radius: 14px;
        padding: 8px;
    }

    .operator-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 6px;
    }

    .operator-action {
        min-height: 48px;
        padding: 8px 6px;
        border-radius: 11px;
        align-items: center;
        text-align: center;
    }

    .operator-action span {
        font-size: 0.82rem;
        line-height: 1.15;
    }

    .operator-action small {
        display: none;
    }

    .answer-wrapper,
    .input-area {
        width: calc(100% - 14px) !important;
    }

    .input-hint {
        display: none !important;
    }
}

/* GPT_OPERATOR_FORCE_VISIBILITY_V1
 * 태블릿 원격 확인용: 운영자 UI는 눈에 띄게, 기존 버튼은 강하게 숨긴다.
 */

.operator-visible-badge {
    display: block !important;
    margin: 0 0 12px 0 !important;
    padding: 12px 14px !important;
    border-radius: 14px !important;
    background: rgba(34, 197, 94, 0.18) !important;
    border: 1px solid rgba(34, 197, 94, 0.45) !important;
    color: #bbf7d0 !important;
    font-weight: 900 !important;
    font-size: 0.95rem !important;
}

/* 상단 기존 버튼 완전 숨김 */
header.app-header .header-actions,
.app-header .header-actions,
.header-actions,
.header-actions *,
button.hdr-btn,
.hdr-btn,
.debug-toggle-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* 하단 빠른 버튼 완전 숨김 */
.app-body .quick-chips,
.app-body .quick-chips-workbench,
.quick-chips,
.quick-chips-workbench,
.quick-chips *,
.quick-chips-workbench *,
button.chip,
.chip,
.chip-primary,
.chip-diag {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 작은 수리콘솔 강제 숨김 */
#repairConsoleButton,
.repairConsoleButton,
.repair-console-btn,
.repair-console-button,
.floating-repair-console,
#repairConsoleRoot,
#repairConsoleRoot * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* 운영자 패널은 무조건 보이게 */
.operator-panel,
.GPT_OPERATOR_STATUS_PANEL_V1 {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.operator-actions {
    display: grid !important;
}


/* GPT_OPERATOR_FORCE_VISIBILITY_V1
 * 태블릿 원격 확인용: 운영자 UI는 눈에 띄게, 기존 버튼은 강하게 숨긴다.
 */

.operator-visible-badge {
    display: block !important;
    margin: 0 0 12px 0 !important;
    padding: 12px 14px !important;
    border-radius: 14px !important;
    background: rgba(34, 197, 94, 0.18) !important;
    border: 1px solid rgba(34, 197, 94, 0.45) !important;
    color: #bbf7d0 !important;
    font-weight: 900 !important;
    font-size: 0.95rem !important;
}

/* 상단 기존 버튼 완전 숨김 */
header.app-header .header-actions,
.app-header .header-actions,
.header-actions,
.header-actions *,
button.hdr-btn,
.hdr-btn,
.debug-toggle-btn {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
}

/* 하단 빠른 버튼 완전 숨김 */
.app-body .quick-chips,
.app-body .quick-chips-workbench,
.quick-chips,
.quick-chips-workbench,
.quick-chips *,
.quick-chips-workbench *,
button.chip,
.chip,
.chip-primary,
.chip-diag {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* 작은 수리콘솔 강제 숨김 */
#repairConsoleButton,
.repairConsoleButton,
.repair-console-btn,
.repair-console-button,
.floating-repair-console,
#repairConsoleRoot,
#repairConsoleRoot * {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* 운영자 패널은 무조건 보이게 */
.operator-panel,
.GPT_OPERATOR_STATUS_PANEL_V1 {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.operator-actions {
    display: grid !important;
}


/* GPT_OPERATOR_PANEL_IN_BODY_FIX_V1 */
.app-body > .operator-panel,
.operator-panel.GPT_OPERATOR_STATUS_PANEL_V1 {
    position: relative !important;
    z-index: 999 !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin: 12px auto !important;
}

.answer-wrapper {
    position: relative !important;
    z-index: 1 !important;
}

/* ENGINE_LOG_CLOSE_FLOW_V1 */
.operator-action.danger-soft {
    background: rgba(239, 68, 68, 0.13) !important;
    border-color: rgba(239, 68, 68, 0.32) !important;
}

.engine-log-close-big {
    min-height: 42px !important;
    padding: 0 14px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
    background: rgba(239, 68, 68, 0.12) !important;
    color: #ef4444 !important;
    font-weight: 900 !important;
    font-size: 0.92rem !important;
    cursor: pointer !important;
}

.debug-drawer-header {
    gap: 10px !important;
}

.debug-drawer-header .close-btn {
    min-width: 46px !important;
    min-height: 42px !important;
    font-size: 1.25rem !important;
    border-radius: 12px !important;
}

/* HISTORY_PANEL_BACK_BUTTON_V1 */
.history-top-bar {
    gap: 10px !important;
}

/* MOBILE_OPERATOR_USABILITY_FIX_V1
 * 폰 화면에서는 운영자 패널을 압축하고 입력/전송 영역이 가로로 잘리지 않게 한다.
 */
@media (max-width: 640px) {
    html,
    body {
        overflow-x: hidden !important;
    }

    body {
        width: 100% !important;
    }

    .app-header {
        min-height: 58px !important;
        height: 58px !important;
        padding: 8px 14px !important;
    }

    .header-left {
        min-width: 0 !important;
        gap: 8px !important;
    }

    .header-emoji {
        font-size: 1.25rem !important;
        flex: 0 0 auto !important;
    }

    .header-title {
        font-size: 1rem !important;
        line-height: 1.12 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        letter-spacing: 0 !important;
    }

    .header-sub {
        font-size: 0.72rem !important;
        line-height: 1.1 !important;
    }

    .app-body {
        top: 58px !important;
        display: block !important;
        max-width: none !important;
        width: 100% !important;
        padding: 8px 10px 12px !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .operator-panel,
    .operator-panel.GPT_OPERATOR_STATUS_PANEL_V1,
    .app-body > .operator-panel {
        width: 100% !important;
        margin: 0 0 10px !important;
        padding: 8px !important;
        border-radius: 13px !important;
        box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18) !important;
    }

    .operator-visible-badge {
        margin: 0 0 8px !important;
        padding: 8px 10px !important;
        border-radius: 11px !important;
        font-size: 0.78rem !important;
        line-height: 1.35 !important;
    }

    .operator-panel-main {
        margin-bottom: 10px !important;
    }

    .operator-eyebrow {
        font-size: 0.72rem !important;
        margin-bottom: 4px !important;
        letter-spacing: 0 !important;
        text-transform: none !important;
    }

    .operator-title-row {
        display: block !important;
    }

    .operator-title {
        font-size: 0.98rem !important;
        line-height: 1.32 !important;
    }

    .operator-sub {
        margin-top: 5px !important;
        font-size: 0.78rem !important;
        line-height: 1.35 !important;
        color: #cbd5e1 !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    .operator-sub b {
        display: inline !important;
        overflow-wrap: anywhere !important;
        word-break: break-word !important;
    }

    .operator-status-pill {
        display: inline-flex !important;
        margin-top: 8px !important;
        padding: 7px 10px !important;
        font-size: 0.78rem !important;
    }

    .operator-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
    }

    .operator-action {
        min-height: 46px !important;
        padding: 8px 5px !important;
        border-radius: 11px !important;
        align-items: center !important;
        text-align: center !important;
    }

    .operator-action span {
        font-size: 0.8rem !important;
        line-height: 1.15 !important;
    }

    .operator-action small {
        display: none !important;
    }

    .answer-wrapper {
        width: 100% !important;
        margin: 0 0 10px !important;
        overflow: visible !important;
    }

    .answer-box {
        min-height: 160px !important;
        height: auto !important;
        max-height: none !important;
        padding: 12px !important;
        border-radius: 14px !important;
        font-size: 0.94rem !important;
        line-height: 1.65 !important;
    }

    .input-area {
        width: 100% !important;
        margin: 0 !important;
        padding: 10px !important;
        position: sticky !important;
        bottom: 0 !important;
        border-radius: 14px !important;
        background: rgba(248, 250, 252, 0.96) !important;
        border: 1px solid rgba(226, 232, 240, 0.95) !important;
        box-shadow: 0 -8px 22px rgba(15, 23, 42, 0.14) !important;
    }

    .input-row {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .input-row textarea,
    #q {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 94px !important;
        height: 94px !important;
        padding: 12px !important;
        border-radius: 14px !important;
        font-size: 1rem !important;
        line-height: 1.45 !important;
    }

    #askBtn {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 50px !important;
        height: 50px !important;
        border-radius: 14px !important;
        font-size: 1rem !important;
    }

    .debug-drawer {
        width: 100vw !important;
        right: -100vw !important;
    }

    .debug-drawer.open {
        right: 0 !important;
    }
}

@media (max-width: 380px) {
    .operator-actions {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    }

    .operator-action span {
        font-size: 0.76rem !important;
    }
}

.history-top-actions {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    margin-left: auto !important;
}

.history-back-btn {
    min-height: 42px !important;
    padding: 0 14px !important;
    border-radius: 12px !important;
    border: 1px solid rgba(59, 130, 246, 0.34) !important;
    background: rgba(59, 130, 246, 0.12) !important;
    color: #2563eb !important;
    font-weight: 900 !important;
    font-size: 0.92rem !important;
    cursor: pointer !important;
}

.history-clear-btn {
    min-height: 42px !important;
    border-radius: 12px !important;
}

@media (max-width: 520px) {
    .history-top-bar {
        flex-wrap: wrap !important;
    }

    .history-top-actions {
        width: 100% !important;
        justify-content: space-between !important;
        margin-left: 0 !important;
    }

    .history-back-btn,
    .history-clear-btn {
        flex: 1 1 auto !important;
        min-height: 46px !important;
    }
}

/* WORK_STATE_VIEWER_BUTTON_V1 */
.operator-action.state {
    background: rgba(168, 85, 247, 0.14) !important;
    border-color: rgba(168, 85, 247, 0.34) !important;
}

/* CODE_NAV_MAP_VIEWER_BUTTON_V1 */
.operator-action.code-map {
    background: rgba(14, 165, 233, 0.13) !important;
    border-color: rgba(14, 165, 233, 0.34) !important;
}

/* WORK_REPORT_VIEWER_BUTTON_V1 */
.operator-action.report {
    background: rgba(245, 158, 11, 0.14) !important;
    border-color: rgba(245, 158, 11, 0.38) !important;
}

/* MODULE_OWNERSHIP_VIEWER_BUTTON_V1 */
.operator-action.module-map {
    background: rgba(34, 197, 94, 0.14) !important;
    border-color: rgba(34, 197, 94, 0.38) !important;
}

/* MODULE_FLOW_VIEWER_BUTTON_V1 */
.operator-action.module-flow {
    background: rgba(56, 189, 248, 0.14) !important;
    border-color: rgba(56, 189, 248, 0.38) !important;
}

/* MODULE_DEPENDENCY_VIEWER_BUTTON_V1 */
.operator-action.module-dependency {
    background: rgba(168, 85, 247, 0.14) !important;
    border-color: rgba(168, 85, 247, 0.38) !important;
}

/* MODULE_FUNCTION_GROUPS_VIEWER_BUTTON_V1 */
.operator-action.module-functions {
    background: rgba(251, 146, 60, 0.14) !important;
    border-color: rgba(251, 146, 60, 0.38) !important;
}
