/* Products Form Page Styles */
.form-page-wrapper {
    display: flex;
    height: calc(100vh - 68px); /* Adjust based on header height */
    overflow: hidden;
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
    position: relative;
    background-color: #f5f5f5;
}

.form-page-wrapper .main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
    background-color: #f5f5f5;
}

@media (max-width: 768px) {
    .form-page-wrapper {
        height: calc(100vh - 80px);
        width: calc(100% + 40px);
        margin-left: -20px;
        margin-right: -20px;
    }
    
    .form-page-wrapper .main-content {
        padding: 15px;
    }
}

/* Action Menu Popup Styles */
.popup-overlay {
    display: block;              /* 常時表示 */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: none;            /* 黒い背景を消す */
    z-index: 1300;
    pointer-events: none;        /* 背景側はクリック無効 */
}

.popup-content {
    background-color: white;
    padding: 16px;
    border-radius: 8px;
    width: 260px;                /* 仕入番号・管理番号と被らない横幅 */
    position: fixed;
    top: 140px;                  /* 仕入番号・管理番号エリアを避ける */
    right: 20px;
    max-height: calc(100vh - 170px);
    overflow-y: auto;
    pointer-events: auto;        /* パネルだけ操作可能 */
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid #ccc;
}

/* ドラッグ移動用 */
.panel-drag-handle {
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    padding-bottom: 6px;
    border-bottom: 1px solid #eee;
    margin-bottom: 10px;
}

.panel-drag-handle-header {
    padding: 8px 0;
}

.popup-content.dragging {
    opacity: 0.95;
}

/* 操作メニューボタン行 */
.action-menu-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.action-menu-row-last {
    margin-bottom: 0;
}

/* 操作メニューボタン */
.action-menu-button {
    flex: 1;
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
}

.action-menu-button:hover {
    background-color: #2980b9;
}

/* 上書き保存ボタンを赤色に */
.overwrite-btn {
    background-color: #e53935;   /* 赤 */
    color: #ffffff;
}

.overwrite-btn:hover {
    background-color: #c62828;   /* 濃い赤 */
}

/* 保存中インジケータ */
.saving-indicator { 
    font-size: 12px; 
    color: #555; 
    margin-bottom: 10px;
}

/* Shared Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    justify-content: center;
    align-items: flex-start;
    padding-top: 40px;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-buttons {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 140px;
}

.modal-btn {
    width: 100%;
    padding: 5px 0;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    color: white;
    font-size: 14px;
}

.modal-btn-close {
    background-color: #1976d2;
}

.modal-btn-close:hover {
    background-color: #1565c0;
}

.modal-btn-copy {
    background-color: #4CAF50;
}

.modal-btn-copy:hover {
    background-color: #45a049;
}

.modal-inner {
    margin-top: 30px;
}

.modal-inner p {
    margin: 0.5em 0;
    color: #333;
}

.modal-inner p:not(:has(strong)) {
    color: #999;
}
